Debian Codegraph @

tests/API/XCCDF/unittests/test_xccdf_sub_title.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2 . $builddir/tests/test_common.sh
3
4 set -e
5 set -o pipefail
6
7 name=$(basename $0 .sh)
8 result=$(mktemp -t ${name}.res.XXXXXX)
9 report=$(mktemp -t ${name}.res.XXXXXX)
10 stdout=$(mktemp -t ${name}.out.XXXXXX)
11 stderr=$(mktemp -t ${name}.err.XXXXXX)
12
13 echo "Stdout file = $stdout"
14 echo "Stderr file = $stderr"
15 echo "Result file = $result"
16 echo "Report file = $report"
17
18 $OSCAP xccdf eval \
19 --results $result --report $report $srcdir/${name}.xccdf.xml > $stdout 2> $stderr
20 [ -f $stderr ]; [ ! -s $stderr ]
21 cat $stdout | grep "This title is variable: No profile"; :> $stdout
22 $OSCAP xccdf validate --skip-schematron $result; :> $result
23 grep 'This description is substituted according to the selected policy:.*No profile' $report
24 grep 'This title is variable:.*No profile' $report
25 grep 'sub ' $report || x=1; [ "x$x" == "x1" ]; unset x; :> $report
26 $OSCAP xccdf generate guide --output $report $srcdir/${name}.xccdf.xml > $stdout 2> $stderr
27 grep 'This title is variable:.*No profile' $report
28 grep 'sub ' $report || x=1; [ "x$x" == "x1" ]; unset x; :> $report
29
30
31 $OSCAP xccdf eval --profile xccdf_moc.elpmaxe.www_profile_1 \
32 --results $result --report $report $srcdir/${name}.xccdf.xml > $stdout 2> $stderr
33 [ -f $stderr ]; [ ! -s $stderr ]
34 cat $stdout | grep "This title is variable: The First Profile"; :> $stdout
35 $OSCAP xccdf validate --skip-schematron $result; :> $result
36 grep 'This description is substituted according to the selected policy:.*The First Profile' $report
37 grep 'This title is variable:.*The First Profile' $report
38 grep 'sub ' $report || x=1; [ "x$x" == "x1" ]; unset x; :> $report
39 $OSCAP xccdf generate guide --profile xccdf_moc.elpmaxe.www_profile_1 \
40 --output $report $srcdir/${name}.xccdf.xml
41 grep 'This title is variable:.*The First Profile' $report
42 grep 'sub ' $report || x=1; [ "x$x" == "x1" ]; unset x; :> $report
43
44 $OSCAP xccdf eval --profile xccdf_moc.elpmaxe.www_profile_2 \
45 --results $result --report $report $srcdir/${name}.xccdf.xml > $stdout 2> $stderr
46 [ -f $stderr ]; [ ! -s $stderr ]
47 cat $stdout | grep "This title is variable: The Second Profile"; rm $stdout
48 $OSCAP xccdf validate --skip-schematron $result; rm $result
49 grep 'This description is substituted according to the selected policy:.*The Second Profile' $report
50 grep 'This title is variable:.*The Second Profile' $report
51 grep 'sub ' $report || x=1; [ "x$x" == "x1" ]; unset x; rm $report
52 $OSCAP xccdf generate guide --profile xccdf_moc.elpmaxe.www_profile_2 \
53 --output $report $srcdir/${name}.xccdf.xml
54 grep 'This title is variable:.*The Second Profile' $report
55 grep 'sub ' $report || x=1; [ "x$x" == "x1" ]; unset x; :> $report