From 4913051ba61c6c43ef03ceea4e0e1a64d6f3d58a Mon Sep 17 00:00:00 2001 From: cjihrig Date: Tue, 4 Aug 2020 14:28:47 -0400 Subject: [PATCH] wasi: add __wasi_fd_filestat_set_times() test PR-URL: https://github.com/nodejs/node/pull/34623 Reviewed-By: Gus Caplan Reviewed-By: Jiawen Geng Reviewed-By: David Carlier Reviewed-By: James M Snell --- test/wasi/c/stat.c | 10 ++++++++++ test/wasi/wasm/stat.wasm | Bin 34898 -> 37857 bytes 2 files changed, 10 insertions(+) diff --git a/test/wasi/c/stat.c b/test/wasi/c/stat.c index e4fcafd713d855..877e5b68a130a2 100644 --- a/test/wasi/c/stat.c +++ b/test/wasi/c/stat.c @@ -11,6 +11,7 @@ #define SIZE 500 int main(void) { + struct timespec times[2]; struct stat st; int fd; int ret; @@ -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); diff --git a/test/wasi/wasm/stat.wasm b/test/wasi/wasm/stat.wasm index 6209314793834776987c37738131f9e1ead9daaa..4a50c0282bb60a43d9bb04291a01ec1461213c16 100755 GIT binary patch delta 9528 zcmZ`<31Ah~)t)o+)=VA@kVwcv&V2$V3K$F~!38o;mhxM6T+sh7qJR)U*<65-_cRMB zxQ_}7NK_Q-PZW(+YZY;+;#zlY#cHdz*wU6NwpRV+|IVFxFQ8Op=FUCmd}q1mo;hH1-(6rLBxpsC3?FQV^h!`vF~b^VgNjw+lx zd*(r59f?bI#@SmmAURm-O{U&p1r_&36LSb4=kx1Ag!;BPKX>vR62-#^Pd)t(>qeDZHMROKiymWvqk{v#7NZm;%=j~}VM}ubpQQEARKkgNoOvV_KFr5FDL4s_|U74Nh z)N`ioTrUI1ldCeE2jy@2PNv&1H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