From 3c4fec9fed5cea10183da2343400fcbb12f7a510 Mon Sep 17 00:00:00 2001 From: gammazero <11790789+gammazero@users.noreply.github.com> Date: Wed, 14 Aug 2024 04:23:25 -0700 Subject: [PATCH] fix sharness test for other os --- sharness/t0040-unixfs-mode-modtime.sh | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/sharness/t0040-unixfs-mode-modtime.sh b/sharness/t0040-unixfs-mode-modtime.sh index 102348f..c4e5252 100755 --- a/sharness/t0040-unixfs-mode-modtime.sh +++ b/sharness/t0040-unixfs-mode-modtime.sh @@ -17,9 +17,15 @@ test_expect_success "create test file with mode and mtime" ' test_expect_success "retrieve file with mode and mtime" ' ipget -o data.txt --node=local "/ipfs/$( out && - echo "660000000 100664" > expect && - test_cmp expect out + if test $(uname -s) = "Darwin"; then + stat -f "%m %p" data.txt > out && + echo "660000000 100664" > expect && + test_cmp expect out + elif test $(uname -s) = "Linux"; then + stat --format="%Z %a" data.txt > out && + echo "660000000 664" > expect2 && + test_cmp expect out + fi ' test_expect_success "create a test directory" ' @@ -30,9 +36,17 @@ test_expect_success "create a test directory" ' test_expect_success "retrieve a directory" ' ipget --node=local -o got_dir "/ipfs/$( out2 && - echo "660000000 40775" > expect2 && - test_cmp expect2 out2 + if test $(uname -s) = "Darwin"; then + stat -f "%m %p" got_dir > out2 && + echo "660000000 40775" > expect2 && + test_cmp expect2 out2 + elif test $(uname -s) = "Linux"; then + stat --format="%Z %a" got_dir > out2 && + echo "660000000 40775" > expect2 && + test_cmp expect2 out2 + fi + + ' # kill the local ipfs node