Skip to content

Commit

Permalink
Merge pull request #6908 from ipfs/test/test-sharness-tests
Browse files Browse the repository at this point in the history
test(sharness): test our tests
  • Loading branch information
Stebalien committed Feb 18, 2020
2 parents ff0feb4 + 6e8c25e commit 25fbf19
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/sharness/t0001-tests-work.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

test_description="Test sharness tests are correctly written"

. lib/test-lib.sh

for file in $(find .. -maxdepth 1 -name 't*.sh' -type f); do
test_expect_success "test in $file finishes" '
grep -q "^test_done\b" "$file"
'

test_expect_success "test in $file has a description" '
test_must_fail grep -L "^test_description=" "$file"
'

# We have some tests that manually kill.
case "$(basename "$file")" in
t0060-daemon.sh|t0023-shutdown.sh) continue ;;
esac

test_expect_success "test in $file has matching ipfs start/stop" '
awk "/^ *[^#]*test_launch_ipfs_daemon/ { if (count != 0) { exit(1) }; count++ } /^ *[^#]*test_kill_ipfs_daemon/ { if (count != 1) { exit(1) }; count-- } END { exit(count) }" "$file"
'
done

test_done

0 comments on commit 25fbf19

Please sign in to comment.