Skip to content

Commit

Permalink
wasi: add __wasi_fd_filestat_set_times() test
Browse files Browse the repository at this point in the history
PR-URL: #34623
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
cjihrig authored and addaleax committed Sep 22, 2020
1 parent adb4ace commit 449d82f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/wasi/c/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define SIZE 500

int main(void) {
struct timespec times[2];
struct stat st;
int fd;
int ret;
Expand All @@ -33,6 +34,15 @@ int main(void) {
assert(ret == 0);
assert(st.st_size == SIZE);

times[0].tv_sec = 4;
times[0].tv_nsec = 0;
times[1].tv_sec = 9;
times[1].tv_nsec = 0;
assert(0 == futimens(fd, times));
assert(0 == fstat(fd, &st));
assert(4 == st.st_atime);
assert(9 == st.st_mtime);

ret = close(fd);
assert(ret == 0);

Expand Down
Binary file modified test/wasi/wasm/stat.wasm
Binary file not shown.

0 comments on commit 449d82f

Please sign in to comment.