diff --git a/test/wasi/c/main_args.c b/test/wasi/c/main_args.c new file mode 100644 index 00000000000000..48fbfa33ea523e --- /dev/null +++ b/test/wasi/c/main_args.c @@ -0,0 +1,10 @@ +#include +#include + +int main(int argc, char** argv) { + assert(argc == 3); + assert(0 == strcmp(argv[0], "foo")); + assert(0 == strcmp(argv[1], "-bar")); + assert(0 == strcmp(argv[2], "--baz=value")); + return 0; +} diff --git a/test/wasi/test-wasi.js b/test/wasi/test-wasi.js index 01d5aa8fe5cc28..fbd51148cde41f 100644 --- a/test/wasi/test-wasi.js +++ b/test/wasi/test-wasi.js @@ -15,7 +15,7 @@ if (process.argv[2] === 'wasi-child') { tmpdir.refresh(); const wasmDir = path.join(__dirname, 'wasm'); const wasi = new WASI({ - args: [], + args: ['foo', '-bar', '--baz=value'], env: process.env, preopens: { '/sandbox': fixtures.path('wasi'), @@ -64,6 +64,7 @@ if (process.argv[2] === 'wasi-child') { runWASI({ test: 'getentropy' }); runWASI({ test: 'getrusage' }); runWASI({ test: 'gettimeofday' }); + runWASI({ test: 'main_args' }); runWASI({ test: 'notdir' }); // runWASI({ test: 'poll' }); runWASI({ test: 'preopen_populates' }); diff --git a/test/wasi/wasm/main_args.wasm b/test/wasi/wasm/main_args.wasm new file mode 100755 index 00000000000000..60cb69defe2d32 Binary files /dev/null and b/test/wasi/wasm/main_args.wasm differ