Debian Codegraph @

tests/API/XCCDF/progress/all.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 # Copyright 2012 Red Hat Inc., Durham, North Carolina.
4 # All Rights Reserved.
5
6 set -o pipefail
7
8 . $builddir/tests/test_common.sh
9
10 function test_progress {
11 local PROGRESS=$1
12 local INPUT="$srcdir/$2"
13 local EXPECTED_CONTENT="$3"
14
15 local GENERATED_CONTENT=$($OSCAP xccdf eval $PROGRESS "$INPUT")
16 if [ "$?" != "0" ]; then
17 echo "Unable to generate content, oscap result: $?"
18 return 1
19 fi
20
21 echo "$GENERATED_CONTENT" | grep "$EXPECTED_CONTENT"
22 if [ "$?" == "0" ]; then
23 return 0
24 fi
25
26 echo "Generated content does not contain '$EXPECTED_CONTENT'!"
27 echo "Generated content:"
28 echo "$GENERATED_CONTENT"
29
30 return 1
31 }
32
33 # Testing.
34
35 test_init "test_api_xccdf_progress.log"
36
37 test_run "test_api_xccdf_progress_xccdf11" test_progress --progress content-xccdf11.xml xccdf_moc.elpmaxe.www_rule_1:pass
38 test_run "test_api_xccdf_progress_xccdf12" test_progress --progress content-xccdf12.xml xccdf_moc.elpmaxe.www_rule_1:pass
39
40 test_run "test_api_xccdf_progress_full_xccdf11" test_progress --progress-full content-xccdf11.xml "xccdf_moc.elpmaxe.www_rule_1\\|Rule 1\\|pass"
41
42 test_exit