diff --git a/Tupfile.rules b/Tupfile.rules index 644dd4a..3e4e48b 100644 --- a/Tupfile.rules +++ b/Tupfile.rules @@ -1,3 +1 @@ -.gitignore - -: foreach *.wast |> wat2wasm -o %o %f |> %B.wasm \ No newline at end of file +.gitignore \ No newline at end of file diff --git a/cmd/land/Tupfile b/cmd/land/Tupfile index 51ea52d..33c9413 100644 --- a/cmd/land/Tupfile +++ b/cmd/land/Tupfile @@ -1,4 +1,4 @@ include_rules -: *_test.go | testdata/arbint.wasm testdata/struct.wasm |> vgo test -v -cover -race -o %o |> ../../bin/%d.test +: *_test.go | testdata/*.wasm |> vgo test -v -cover -race -o %o |> ../../bin/%d.test : *.go |> vgo build -o %o |> ../../bin/land diff --git a/cmd/land/testdata/Tupfile b/cmd/land/testdata/Tupfile index cb970cd..586fd90 100644 --- a/cmd/land/testdata/Tupfile +++ b/cmd/land/testdata/Tupfile @@ -4,4 +4,5 @@ CFLAGS += --target=wasm32-unknown-unknown-wasm CFLAGS += --sysroot=~/code/wasmception/sysroot/ CFLAGS += -O0 -nostartfiles -Wl,--no-entry -nostdlib +: foreach *.wast |> wat2wasm -o %o %f |> %B.wasm : foreach *.c |> ~/code/wasmception/dist/bin/clang $(CFLAGS) %f -o %o |> %B.wasm diff --git a/cmd/land/testdata/fileops.wasm b/cmd/land/testdata/fileops.wasm deleted file mode 100644 index c0eb0a4..0000000 Binary files a/cmd/land/testdata/fileops.wasm and /dev/null differ diff --git a/cmd/land/testdata/hello.wasm b/cmd/land/testdata/hello.wasm deleted file mode 100644 index 1828cc6..0000000 Binary files a/cmd/land/testdata/hello.wasm and /dev/null differ diff --git a/cmd/land/testdata/helloworld.c b/cmd/land/testdata/helloworld.c new file mode 100644 index 0000000..b08f327 --- /dev/null +++ b/cmd/land/testdata/helloworld.c @@ -0,0 +1,21 @@ +extern int open(const char *, int); +extern int write(int, char *, int); +extern int close(int); + +__attribute__ ((visibility ("default"))) +int main() { + const char *name = "hello"; + char *msg = "Hello, world!"; + int fd = open(name, 0x42); + int num = write(fd, msg, 13); + if (num == 0) { + return 1; + } + + num = close(fd); + if (num == 0) { + return 1; + } + + return 0; +} diff --git a/cmd/land/testdata/land.h b/cmd/land/testdata/land.h new file mode 100644 index 0000000..618c6f4 --- /dev/null +++ b/cmd/land/testdata/land.h @@ -0,0 +1,9 @@ +#define export __attribute__ ((visibility ("default")) +#define import extern + +import int close(int file); +import int isatty(int file); +import int open(const char *name, int flags, ...); +import int read(int file, char *ptr, int len); +import int write(int file, char *ptr, int len); +import int unlink(char *name); diff --git a/cmd/land/testdata/writefile.wasm b/cmd/land/testdata/writefile.wasm deleted file mode 100644 index 0ddedad..0000000 Binary files a/cmd/land/testdata/writefile.wasm and /dev/null differ