mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-22 16:35:33 +00:00
add test for chdir and getcwd
This commit is contained in:
30
tests/wasix/chdir-getcwd/main.c
Normal file
30
tests/wasix/chdir-getcwd/main.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char cwd[1024];
|
||||
|
||||
int status = EXIT_FAILURE;
|
||||
|
||||
if (chdir("/tmp") != 0)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (getcwd(cwd, sizeof(cwd)) == NULL)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (strcmp(cwd, "/tmp") == 0)
|
||||
{
|
||||
status = EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
end:
|
||||
printf("%d", status);
|
||||
exit(status);
|
||||
}
|
3
tests/wasix/chdir-getcwd/run.sh
Executable file
3
tests/wasix/chdir-getcwd/run.sh
Executable file
@ -0,0 +1,3 @@
|
||||
$WASMER -q run main.wasm > output
|
||||
|
||||
printf "0" | diff -u output - 1>/dev/null
|
Reference in New Issue
Block a user