Skip to content

Commit 2fa24c0

Browse files
cjihrigaddaleax
authored andcommitted
wasi: add __wasi_fd_filestat_set_times() test
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>
1 parent dc49561 commit 2fa24c0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

test/wasi/c/stat.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define SIZE 500
1212

1313
int main(void) {
14+
struct timespec times[2];
1415
struct stat st;
1516
int fd;
1617
int ret;
@@ -33,6 +34,15 @@ int main(void) {
3334
assert(ret == 0);
3435
assert(st.st_size == SIZE);
3536

37+
times[0].tv_sec = 4;
38+
times[0].tv_nsec = 0;
39+
times[1].tv_sec = 9;
40+
times[1].tv_nsec = 0;
41+
assert(0 == futimens(fd, times));
42+
assert(0 == fstat(fd, &st));
43+
assert(4 == st.st_atime);
44+
assert(9 == st.st_mtime);
45+
3646
ret = close(fd);
3747
assert(ret == 0);
3848

test/wasi/wasm/stat.wasm

2.89 KB
Binary file not shown.

0 commit comments

Comments
 (0)