Skip to content

Commit

Permalink
Add test that checks missing rule references for specific profiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
mildas committed Apr 22, 2021
1 parent a3bb639 commit 9351f85
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/missing_refs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
PYTHON_EXECUTABLE="$1"
BENCHMARK="$2"
shift 2
PROFILES=()
while test $# -gt 0; do
PROFILES+=("$1")
shift
done

PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
RETURN_CODE=0

function check_missing_references() {
profile="$1"
if [[ "$profile" == "stig" ]]; then
refs_argument="--missing-stig-ids"
elif [[ "$profile" == "anssi"* ]]; then
refs_argument="--missing-anssi-refs"
else
refs_argument="--missing-$profile-refs"
fi

profile_stats="$("$PYTHON_EXECUTABLE" "$PROJECT_ROOT/build-scripts/profile_tool.py" stats --benchmark "$BENCHMARK" --profile $profile $refs_argument --skip-stats)"

if [ ! -z "$profile_stats" ]; then
printf '%s\n' "$profile_stats" >&2
RETURN_CODE=1
fi
}

for PROFILE in ${PROFILES[@]}; do
check_missing_references "$PROFILE"
done

exit $RETURN_CODE

0 comments on commit 9351f85

Please sign in to comment.