-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest-all
executable file
·44 lines (31 loc) · 861 Bytes
/
test-all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash -eux
# shellcheck disable=SC2155,SC2164,SC2086
readonly TEST_ARGS="$*"
# auto cleanup
at_exit() {
[ "${TMP_DIR:-}" ] && rm -Rf "${TMP_DIR}"
}
trap at_exit EXIT
readonly TMP_DIR="$(mktemp -d /tmp/"$(basename -- "$0")".XXXXXXXXXX)"
if ! pwd | grep -q '^/home/'
then
echo 'This script should be run from /home' >&2
exit 1
fi
#
# runs test in current dir
#
# unit tests + integration tests
cargo test ${TEST_ARGS}
# integration tests as root
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --features as-root --test '*' ${TEST_ARGS}
#
# runs test in /tmp
#
cp -Ra . "${TMP_DIR}"
pushd "${TMP_DIR}"
# unit tests + integration tests
cargo test --test '*' ${TEST_ARGS}
# integration tests as root
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --features as-root --test '*' ${TEST_ARGS}
popd