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