Skip to content

Commit

Permalink
first extremely rough attempt at adding CI support
Browse files Browse the repository at this point in the history
  • Loading branch information
duckinator committed Feb 16, 2019
1 parent a58272c commit 0198857
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.o
*.d
*.a
build/
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CC := clang

SOURCES := $(wildcard src/*.c)

CINCLUDES := -I/usr/include -Ibuild/deps/tinker/include -Ibuild/deps/ali/include/ -Iinclude

override CFLAGS += -std=c11 -pedantic-errors \
-fdiagnostics-show-option -Werror -Weverything \
-Wno-cast-qual -Wno-missing-prototypes -Wno-vla

all: build/dmm-test

build-deps:
mkdir -p build/deps/
cd build/deps; test -d tinker || git clone https://github.com/awooos/tinker.git
cd build/deps; test -d ali || git clone https://github.com/awooos/ali.git
cd build/deps/tinker; git pull
cd build/deps/ali; git checkout .; git pull
cd build/deps/ali/include; rm std*.h

build/dmm-test: $(SOURCES)
$(MAKE) build-deps
${CC} ${CFLAGS} ${CINCLUDES} test/strrev.c $^ build/deps/tinker/src/main.c build/deps/ali/src/number/main.c test/main.c -o $@

test: build/dmm-test
./build/dmm-test

clean:
rm -rf build

.PHONY: all clean test build-deps
24 changes: 24 additions & 0 deletions test/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <stdio.h>
#include <tinker.h>

void add_dmm_tests(void);

char *shitty_print(const char *str) {
size_t len = strlen(str);

for (size_t idx = 0; idx < len; idx++) {
putchar(str[idx]);
}
return (char*)str;
}

int main(void)
{
add_dmm_tests();

if (!tinker_run_tests(&shitty_print)) {
return 1;
}

return 0;
}
18 changes: 18 additions & 0 deletions test/strrev.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <stdlib.h>
#include <string.h>

// copypasta'd from ali for simplicity.
char *strrev(char *str)
{
size_t length = strlen(str);
size_t half_length = length / 2;

for (size_t idx = 0; idx < half_length; idx++) {
char tmp = str[idx];
str[idx] = str[length - idx - 1];
str[length - idx - 1] = tmp;
}

return str;
}

0 comments on commit 0198857

Please sign in to comment.