From bf987098dc9155a7f2ed11369d4768979e6feca5 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sat, 3 Mar 2018 17:56:53 -0700 Subject: [PATCH] Use openlibm --- include/limits.h | 0 include/math.h | 1 + test.sh | 5 +++++ tests/.gitignore | 1 + tests/Makefile | 14 +++++++++++++- tests/alloc.c | 2 +- tests/args.c | 2 +- tests/create.c | 2 +- tests/math.c | 5 +++++ tests/write.c | 2 +- 10 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 include/limits.h create mode 100644 include/math.h create mode 100644 tests/math.c diff --git a/include/limits.h b/include/limits.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/include/math.h b/include/math.h new file mode 100644 index 0000000000..a228a4fafa --- /dev/null +++ b/include/math.h @@ -0,0 +1 @@ +#include diff --git a/test.sh b/test.sh index 91a5726d95..1ee02991ca 100755 --- a/test.sh +++ b/test.sh @@ -2,6 +2,11 @@ set -ex cargo build cargo build --manifest-path crt0/Cargo.toml + +cd openlibm +make +cd .. + cd tests make clean make run diff --git a/tests/.gitignore b/tests/.gitignore index 7cf5819daf..f9aa667a81 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -2,4 +2,5 @@ /args /create /create.out +/math /write diff --git a/tests/Makefile b/tests/Makefile index 2a191bb5c6..ba2b659025 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -2,6 +2,7 @@ BINS=\ alloc \ args \ create \ + math \ write all: $(BINS) @@ -13,4 +14,15 @@ run: $(BINS) for bin in $(BINS); do echo "\\033[1m$${bin}\\033[0m"; ./$${bin} test args; done %: %.c - gcc -nostdinc -nostdlib -I ../include -I ../target/include ../target/debug/libcrt0.a $< ../target/debug/libc.a -o $@ + gcc \ + -nostdinc \ + -nostdlib \ + -I ../include \ + -I ../target/include \ + -I ../openlibm/include \ + -I ../openlibm/src \ + ../target/debug/libcrt0.a \ + $< \ + ../target/debug/libc.a \ + ../openlibm/libopenlibm.a \ + -o $@ diff --git a/tests/alloc.c b/tests/alloc.c index 5b399add45..934f74861b 100644 --- a/tests/alloc.c +++ b/tests/alloc.c @@ -1,7 +1,7 @@ #include #include -int main(int argc, char **argv) { +int main(int argc, char ** argv) { write(STDERR_FILENO, "malloc\n", 7); char * ptr = (char *)malloc(256); write(STDERR_FILENO, "set\n", 4); diff --git a/tests/args.c b/tests/args.c index 70686673e4..276ae3b8a5 100644 --- a/tests/args.c +++ b/tests/args.c @@ -1,7 +1,7 @@ #include #include -int main(int argc, char **argv) { +int main(int argc, char ** argv) { int i; for(i = 0; i < argc; i++) { write(STDOUT_FILENO, argv[i], strlen(argv[i])); diff --git a/tests/create.c b/tests/create.c index c833d06cb6..864496830b 100644 --- a/tests/create.c +++ b/tests/create.c @@ -1,7 +1,7 @@ #include #include -int main(int argc, char **argv) { +int main(int argc, char ** argv) { int fd = creat("create.out", 0755); if (fd >= 0) { write(fd, "Hello World!\n", 13); diff --git a/tests/math.c b/tests/math.c new file mode 100644 index 0000000000..159bb14ced --- /dev/null +++ b/tests/math.c @@ -0,0 +1,5 @@ +#include + +int main(int argc, char ** argv) { + float c = cos(3.14); +} diff --git a/tests/write.c b/tests/write.c index 0a83a90409..5102aca427 100644 --- a/tests/write.c +++ b/tests/write.c @@ -1,6 +1,6 @@ #include -int main(int argc, char **argv) { +int main(int argc, char ** argv) { write(STDOUT_FILENO, "Hello World!\n", 13); return 0; }