add test for chdir and getcwd

This commit is contained in:
M.Amin Rayej
2024-06-02 18:59:32 +03:30
parent 1b880252cd
commit 78cd491c0b
2 changed files with 33 additions and 0 deletions

View 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);
}

View File

@ -0,0 +1,3 @@
$WASMER -q run main.wasm > output
printf "0" | diff -u output - 1>/dev/null