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