| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | # Copyright 2019 Red Hat Inc., Durham, North Carolina. |
| 4 | # All Rights Reserved. |
| 5 | # |
| 6 | # OpenSCAP Test Suite |
| 7 | # |
| 8 | # Authors: |
| 9 | # Jan Černý <[email protected]> |
| 10 | |
| 11 | . $builddir/tests/test_common.sh |
| 12 | |
| 13 | set -e -o pipefail |
| 14 | |
| 15 | echoscip-shell system . . echo. $srcdir |
| 16 | |
| 17 | function test_oscap_infoscip-shell shell shell-project 0.0.0 test_oscap_info(). { |
| 18 | version="$1" |
| 19 | stdout="$(mktempscip-shell system . . mktemp.)" |
| 20 | stderr="$(mktempscip-shell system . . mktemp.)" |
| 21 | ds="$(mktempscip-shell system . . mktemp.)" |
| 22 | cpscip-shell system . . cp. $srcdir/scap-ds.xml $ds |
| 23 | xsed -i "s/X.X/${version}/g" $ds |
| 24 | |
| 25 | $OSCAP info $ds > $stdout 2> $stderr |
| 26 | [scip-shell system . . `[`. ! -s $stderr ] |
| 27 | grepscip-shell system . . grep. -q "Version: $version" $stdout |
| 28 | rmscip-shell system . . rm. $stdout |
| 29 | rmscip-shell system . . rm. $stderr |
| 30 | rmscip-shell system . . rm. $ds |
| 31 | } |
| 32 | |
| 33 | case $(unamescip-shell system . . uname.) in |
| 34 | FreeBSD) |
| 35 | SDS=$(findscip-shell system . . find. $top_srcdir/schemas/sds -maxdepth 1 -mindepth 1 -type d -exec basename {} ';') |
| 36 | ;; |
| 37 | *) |
| 38 | SDS=$(findscip-shell system . . find. $top_srcdir/schemas/sds -maxdepth 1 -mindepth 1 -type d -printf '%f\n') |
| 39 | ;; |
| 40 | esac |
| 41 | |
| 42 | for sds_version in $SDS |
| 43 | do |
| 44 | test_oscap_infoscip-shell shell shell-project 0.0.0 test_oscap_info(). $sds_version |
| 45 | done |