| 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 | # Workaround trac#245 for distcheck |
| 12 | oval=${name}.oval.xml.result.xml |
| 13 | if [ ! -f "$oval" ]; then |
| 14 | ln -s $srcdir/$oval $oval |
| 15 | fi |
| 16 | # Workaround end |
| 17 | |
| 18 | $OSCAP xccdf generate report --output $result $srcdir/${name}.xccdf.xml.result.xml 2> $stderr |
| 19 | |
| 20 | # Workaround |
| 21 | if [ -L "$oval" ]; then |
| 22 | rm $oval |
| 23 | fi |
| 24 | unset oval |
| 25 | # Workaround end |
| 26 | |
| 27 | echo "Stderr file = $stderr" |
| 28 | echo "Result file = $result" |
| 29 | [ -f $stderr ]; [ ! -s $stderr ]; rm $stderr |
| 30 | |
| 31 | grep 'Testing file permissions of /etc/shadow' $result |
| 32 | grep '<code>---------' $result |
| 33 | echo $result |
| 34 | # TODO: Check for the current version, as given by autotools, instead of any version |
| 35 | case $(uname) in |
| 36 | FreeBSD) |
| 37 | grep -E '<a href="http://open-scap.org">OpenSCAP</a>.*[0-9]+\.[0-9]+\.[0-9]+' $result |
| 38 | ;; |
| 39 | *) |
| 40 | grep -P '<a href="http://open-scap.org">OpenSCAP</a> (([0-9]+)\.){2}[0-9]+' $result |
| 41 | ;; |
| 42 | esac |
| 43 | rm $result |