Skip to content

Commit c71a734

Browse files
committed
Changing coverage tests to use sudo in instances where its required to test
1 parent 9f1922b commit c71a734

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

util/build-run-test-coverage-linux.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,18 @@ set +x
6565
run_test_and_aggregate() {
6666
echo "# Running coverage tests for ${1}"
6767

68+
# Determine if sudo is needed for this utility
69+
local SUDO_CMD=""
70+
case "${1}" in
71+
chroot|chown|cp|dd|install|mknod)
72+
if command -v sudo >/dev/null 2>&1 && sudo -n true 2>/dev/null; then
73+
SUDO_CMD="sudo -E"
74+
fi
75+
;;
76+
esac
77+
6878
# Build and run tests for the UTIL
69-
cargo nextest run \
79+
${SUDO_CMD} cargo nextest run \
7080
--profile coverage \
7181
--no-fail-fast \
7282
--color=always \

0 commit comments

Comments
 (0)