Skip to content

Commit 97401b9

Browse files
authored
Merge pull request #6997 from ipfs/chore/sharness_fixes_2019-03-16
Chore/sharness fixes 2019 03 16
2 parents 4acb15d + 51d4383 commit 97401b9

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

bin/test-go-fmt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33
T="$(mktemp)"
4-
find . -name '*.go' '!' -path ./plugin/loader/preload.go | xargs gofmt -l > "$T"
4+
find . \
5+
-path ./test/sharness -prune \
6+
-o -path ./plugin/loader/preload.go -prune \
7+
-o -name '*.go' -print0 | xargs -0 gofmt -l > "$T"
58

69
if [ -n "$(cat $T)" ]; then
710
echo "Following Go code is not formatted."

test/sharness/lib/test-lib.sh

+41
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,47 @@ SHARNESS_LIB="lib/sharness/sharness.sh"
4141

4242
# Please put go-ipfs specific shell functions below
4343

44+
###
45+
# BEGIN Check for pre-existing daemon being stuck
46+
###
47+
wait_prev_cleanup_tick_secs=1
48+
wait_prev_cleanup_max_secs=5
49+
cur_test_pwd="$(pwd)"
50+
51+
while true ; do
52+
echo -n > stuck_cwd_list
53+
54+
lsof -c ipfs -Ffn 2>/dev/null | grep -A1 '^fcwd$' | grep '^n' | cut -b 2- | while read -r pwd_of_stuck ; do
55+
case "$pwd_of_stuck" in
56+
"$cur_test_pwd"*)
57+
echo "$pwd_of_stuck" >> stuck_cwd_list
58+
;;
59+
*)
60+
;;
61+
esac
62+
done
63+
64+
test -s stuck_cwd_list || break
65+
66+
test "$wait_prev_cleanup_max_secs" -le 0 && break
67+
68+
echo "Daemons still running, waiting for ${wait_prev_cleanup_max_secs}s"
69+
sleep $wait_prev_cleanup_tick_secs
70+
71+
wait_prev_cleanup_max_secs="$(( $wait_prev_cleanup_max_secs - $wait_prev_cleanup_tick_secs ))"
72+
done
73+
74+
if test -s stuck_cwd_list ; then
75+
test_expect_success "ipfs daemon (s)seems to be running with CWDs of
76+
$(cat stuck_cwd_list)
77+
Almost certainly a leftover from a prior test, ABORTING" 'false'
78+
79+
test_done
80+
fi
81+
###
82+
# END Check for pre-existing daemon being stuck
83+
###
84+
4485
# Make sure the ipfs path is set, also set in test_init_ipfs but that
4586
# is not always used.
4687
export IPFS_PATH="$(pwd)/.ipfs"

0 commit comments

Comments
 (0)