aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_switch_id.sh
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-06-20 11:15:47 -0400
committerNick Mathewson <nickm@torproject.org>2016-06-20 11:15:47 -0400
commit5fbd195918b4f5ad73130547c2ca58fd69baded0 (patch)
treef0442d6709fc5ac0f4402a88b4c2df63135a8047 /src/test/test_switch_id.sh
parent603cb712ef756dd700a52e837bcd643a96311ad6 (diff)
downloadtor-5fbd195918b4f5ad73130547c2ca58fd69baded0.tar.gz
tor-5fbd195918b4f5ad73130547c2ca58fd69baded0.zip
Coverage hack for test_switch_id.sh
This hack provides a way to make sure we can see coverage from test-switch-id. If you set OVERRIDE_GCDA_PERMISSIONS_HACK, we temporarily make the .gcda files mode 0666 before we run the test scripts, and then we set them to 0644 again afterwards. That's necessary because the test_switch_id.sh script does a setuid() to 'nobody' part way through, and drops the ability to change its mind back.
Diffstat (limited to 'src/test/test_switch_id.sh')
-rwxr-xr-xsrc/test/test_switch_id.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/test_switch_id.sh b/src/test/test_switch_id.sh
index 1b4e0998b5..79c44f2eb1 100755
--- a/src/test/test_switch_id.sh
+++ b/src/test/test_switch_id.sh
@@ -10,6 +10,10 @@ if test "`id -u nobody`" = ""; then
exit 1
fi
+if test "$OVERRIDE_GCDA_PERMISSIONS_HACK" = "yes"; then
+ find src -type f -name '*gcda' -print0 | xargs -0 chmod 0666
+fi
+
"${builddir:-.}/src/test/test-switch-id" nobody setuid || exit 1
"${builddir:-.}/src/test/test-switch-id" nobody root-bind-low || exit 1
"${builddir:-.}/src/test/test-switch-id" nobody setuid-strict || exit 1
@@ -19,6 +23,9 @@ fi
"${builddir:-.}/src/test/test-switch-id" nobody have-caps || exit 1
"${builddir:-.}/src/test/test-switch-id" nobody setuid-keepcaps || exit 1
+if test "$OVERRIDE_GCDA_PERMISSIONS_HACK" = "yes"; then
+ find src -type f -name '*gcda' -print0 | xargs -0 chmod 0644
+fi
echo "All okay"