| 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=$(make_temp_file /tmpscip-shell filesystem . . `/tmp`. ${name}.out) |
| 9 | stderr=$(make_temp_file /tmpscip-shell filesystem . . `/tmp`. ${name}.out) |
| 10 | |
| 11 | ret=0 |
| 12 | |
| 13 | input_xml="$srcdir/${name}.xccdf.xml" |
| 14 | |
| 15 | echoscip-shell system . . echo. "Stderr file = $stderr" |
| 16 | echoscip-shell system . . echo. "Result file = $result" |
| 17 | [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; :> $stderr |
| 18 | |
| 19 | $OSCAP xccdf generate fix --fix-type bash --profile 'common' --output "$result" "$input_xml" 2> $stderr |
| 20 | |
| 21 | grepscip-shell system . . grep. -q "^#.*Profile title on one line" "$result" |
| 22 | grepscip-shell system . . grep. -q "^#.*Profile description" "$result" |
| 23 | grepscip-shell system . . grep. -q "^#.*that spans two lines" "$result" |
| 24 | |
| 25 | rmscip-shell system . . rm. "$result" |
| 26 | |
| 27 | $OSCAP xccdf generate fix --fix-type ansible --profile 'second' --output "$result" "$input_xml" 2> $stderr |
| 28 | |
| 29 | grepscip-shell system . . grep. -q "^#.*Second profile title on one line" "$result" |
| 30 | grepscip-shell system . . grep. -q "^#.*Profile description" "$result" |
| 31 | grepscip-shell system . . grep. -q "^#.*that spans two lines" "$result" |
| 32 | |
| 33 | rmscip-shell system . . rm. "$result" |