diff --git a/test/wasi/c/link.c b/test/wasi/c/link.c new file mode 100644 index 00000000000000..16added7d5c604 --- /dev/null +++ b/test/wasi/c/link.c @@ -0,0 +1,17 @@ +#include +#include +#include + +#define OLD "/sandbox/input.txt" +#define NEW "/tmp/output.txt" + +int main() { + struct stat st_old; + struct stat st_new; + + assert(0 == stat(OLD, &st_old)); + assert(0 == link(OLD, NEW)); + assert(0 == stat(NEW, &st_new)); + assert(st_old.st_ino == st_new.st_ino); + return 0; +} diff --git a/test/wasi/test-wasi.js b/test/wasi/test-wasi.js index fbd51148cde41f..357eb7531fbea2 100644 --- a/test/wasi/test-wasi.js +++ b/test/wasi/test-wasi.js @@ -64,6 +64,7 @@ if (process.argv[2] === 'wasi-child') { runWASI({ test: 'getentropy' }); runWASI({ test: 'getrusage' }); runWASI({ test: 'gettimeofday' }); + runWASI({ test: 'link' }); runWASI({ test: 'main_args' }); runWASI({ test: 'notdir' }); // runWASI({ test: 'poll' }); diff --git a/test/wasi/wasm/link.wasm b/test/wasi/wasm/link.wasm new file mode 100755 index 00000000000000..60f5c07601a2af Binary files /dev/null and b/test/wasi/wasm/link.wasm differ