Skip to content

Commit

Permalink
fix sharness test for other os
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Aug 14, 2024
1 parent 3b27296 commit 3c4fec9
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions sharness/t0040-unixfs-mode-modtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/$(<hash)" &&
test_cmp test_file "data.txt" &&
stat -f "%m %p" data.txt > 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" '
Expand All @@ -30,9 +36,17 @@ test_expect_success "create a test directory" '

test_expect_success "retrieve a directory" '
ipget --node=local -o got_dir "/ipfs/$(<dir_hash)" &&
stat -f "%m %p" got_dir > 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
Expand Down

0 comments on commit 3c4fec9

Please sign in to comment.