generate_coverage: add skip-test option
# fucking bash. TODO: rewrite the whole file in a sane language
# From https://stackoverflow.com/a/14203146/6551168
POSITIONAL=()
+SKIP_TEST=false
while [[ $# -gt 0 ]]; do
key="$1"
@@ -11,6 +12,10 @@ while [[ $# -gt 0 ]]; do
PRINT_COVERAGE=true
shift # past argument
;;
+ --skip-tests)
+ SKIP_TEST=true
+ shift # past value
+ ;;
--profile-only)
PROFILE_ONLY=true
shift # past argument
@@ -26,6 +31,7 @@ while [[ $# -gt 0 ]]; do
echo " --print-coverage : generate textual coverage report. Requires \`cargo cov\`"
echo " --profile-only : don't run grcov but only generate the profraw files"
echo " --cargo-args 'arg' : pass custom arguments to cargo test"
+ echo " --skip-tests : skip the testrun and only generate the report from the existing uhyve-*.profraw files"
exit 0
shift # past argument
;;
@@ -71,6 +77,7 @@ if ! rustfilt --version &>/dev/null; then
|| exit_with_error "Failed to install rustfilt"
fi
+if [ "$SKIP_TEST" = false ]; then
# Test coverage requires clean build, so that everything is instrumented
cargo clean
echo "Running cargo test. This may take a while."
@@ -87,6 +94,8 @@ if [ $? != 0 ]; then
exit_with_error "Coverage run of cargo test failed." "$TEST_JSON_OUTPUT"
fi
echo "Finished cargo test successfully"
+fi
+echo "Finished cargo test successfully"
cargo profdata -- merge -sparse uhyve-*.profraw -o uhyve.profdata \
|| exit_with_error "Failed to merge raw profiling data"
