File tree 1 file changed +41
-0
lines changed
1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,47 @@ SHARNESS_LIB="lib/sharness/sharness.sh"
41
41
42
42
# Please put go-ipfs specific shell functions below
43
43
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
+
44
85
# Make sure the ipfs path is set, also set in test_init_ipfs but that
45
86
# is not always used.
46
87
export IPFS_PATH=" $( pwd) /.ipfs"
You can’t perform that action at this time.
0 commit comments