jdh8 / metallic

C runtime library (libc) for WebAssembly
MIT License
35 stars 2 forks source link

How do I run the test suite? #2

Closed IngwiePhoenix closed 5 years ago

IngwiePhoenix commented 5 years ago

I had to patch the Makefile a little bit to get it to use my LLVM 7 setup on OS X - but after that, it built successfuly! Now... I would like to run the test suite to see if this actually works. How can I do that?

Also, what I did was:

Ingwie@Ingwies-MBP.fritz.box ~/W/g/metallic $ git diff
diff --git a/Makefile b/Makefile
index 7867f1a..e36045a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,14 @@
 override CPPFLAGS += -MMD -MP -MQ $@
 override CFLAGS += -pipe -O3 -Wall -flto

-WACC = clang --target=wasm32-unknown-unknown-wasm
+WACC =  /usr/local/opt/llvm/bin/clang --target=wasm32-unknown-unknown-wasm
 LDFLAGS = -lm

 metallic.bc: CC = $(WACC)
 metallic.bc: CPPFLAGS += -I include
 metallic.bc: CFLAGS += -fno-builtin-memcpy
 metallic.bc: $(patsubst %.c, %.o, $(wildcard src/*/*.c src/*/*/*.c))
-       llvm-link -o $@ $^
+       /usr/local/opt/llvm/bin/llvm-link -o $@ $^

 check: $(patsubst %.c, %.out, $(wildcard test/wasm/*/*.c test/wasm/*/*/*.c)) \
        $(patsubst %.c, %.exe, $(wildcard test/native/*/*.c test/native/*/*/*.c))

I hope to use this soon! Because a simple hello-world program easily blows up the resulting filesize by quite a margin...

jdh8 commented 5 years ago

Just make and then make check like everything else (?)

It is how static linking works. We can only do static linking because there is no system libc to link. You can try compiling a statically linked native hello world, and it blows up too....

jdh8 commented 5 years ago

I just fixed some bashism in 013fd5d470efba570ef35527677cb272c64bdf49 and tested on Ubuntu, which defaults to dash (a non-bash shell) as scripting shell. Along with #3 solved, running test is as easy as make check with LLVM 8+, a POSIX shell, and make. Therefore, I'm closing this issue.