From 8438d1498df6ea035573c161c444a29b22a043eb Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 19 Jan 2020 14:34:57 -0500 Subject: [PATCH] test: improve wasi stat test This commit improved the stat test a bit by verifying that S_ISDIR() works properly. It also adds missing coverage for __wasi_path_remove_directory(). PR-URL: https://github.com/nodejs/node/pull/31413 Reviewed-By: Chengzhong Wu Reviewed-By: David Carlier Reviewed-By: Daijiro Wachi Reviewed-By: Beth Griggs Reviewed-By: Rich Trott --- test/wasi/c/stat.c | 10 ++++++++++ test/wasi/wasm/stat.wasm | Bin 34188 -> 34898 bytes 2 files changed, 10 insertions(+) diff --git a/test/wasi/c/stat.c b/test/wasi/c/stat.c index fd3854937b9e6e..e4fcafd713d855 100644 --- a/test/wasi/c/stat.c +++ b/test/wasi/c/stat.c @@ -49,5 +49,15 @@ int main(void) { ret = stat(PATH, &st); assert(ret == -1); + ret = stat(OUTPUT_DIR, &st); + assert(ret == 0); + assert(S_ISDIR(st.st_mode)); + + ret = rmdir(OUTPUT_DIR); + assert(ret == 0); + + ret = stat(OUTPUT_DIR, &st); + assert(ret == -1); + return 0; } diff --git a/test/wasi/wasm/stat.wasm b/test/wasi/wasm/stat.wasm index 0d7980970fbe8b38add0fd6ed1fc49d4ddd8ed1f..6209314793834776987c37738131f9e1ead9daaa 100755 GIT binary patch delta 5402 zcmaJ_3shBA8b1HI4=!9T925|^7ue^Dyp)G17ksl-d;yxza^K%eeP96o5kYrpa1=T```cG zhm9N553AIw2Tb3YwT8+(RU8JZW!bzX53Uq%LWbgtFjQ6SivfIU z5&iJBe!pKSb|~6DA{<~x-eW=D0m)PCS``u6^Yqjet)Bj>MNDxhk#?qNTj^b~^K*BQ z7G$?-;-aY+Oc39i2EksDWiEmS@qjr4c8F^8Z;<}pycPC~XD$6eh|`vbkW*-7uvtvE zPDi@Ys>2rXiIuEkL+<(FDJfEVgJfvIdKc=bA9b)fG8wgcEM z&~`~Ec9V2Bc+^}75R1m*j`}!fb9o%0JK0{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