Debian Codegraph @

tests/API/OVAL/unittests/test_variable_conversion.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 # Regression test for rhbz#1945580
4
5 . $builddir/tests/test_common.sh
6
7 set -e -o pipefail
8
9 result=$(mktempscip-shell system . . mktemp.)
10 stderr=$(mktempscip-shell system . . mktemp.)
11
12 [scip-shell system . . `[`. ! -e "/tmp/test_variable_conversion.txtscip-shell filesystem . . `/tmp/test_variable_conversion.txt`." ] && rmscip-shell system . . rm. -f "/tmp/test_variable_conversion.txtscip-shell filesystem . . `/tmp/test_variable_conversion.txt`."
13 echoscip-shell system . . echo. "auth required pam_faillock.so preauth silent even_deny_root deny=3 fail_interval=900 unlock_time=never fail_interval=900 deny=3" > "/tmp/test_variable_conversion.txtscip-shell filesystem . . `/tmp/test_variable_conversion.txt`."
14
15 $OSCAP oval eval --results $result $srcdir/test_variable_conversion.oval.xml 2> $stderr
16 [scip-shell system . . `[`. "$?" -eq 0 ]
17
18 grepscip-shell system . . grep. -Pq "W: oscap:\s+Conversion of the string \"never\" to an integer \(\d+ bits\) failed: Invalid argument" "$stderr"
19 grepscip-shell system . . grep. -Pq "W: oscap:\s+Can't compare variable 'oval:ssg-var_accounts_passwords_pam_faillock_unlock_time:var:1' value = '0' with collected item entity = 'never'" "$stderr"
20 ! grepscip-shell system . . grep. -Pq "OpenSCAP Error:\s+Conversion of the string \"never\" to an integer \(\d+ bits\) failed: Invalid argument" "$stderr"
21 ! grepscip-shell system . . grep. -Pq "^E: oscap:\s+Error occured when comparing a variable 'oval:ssg-var_accounts_passwords_pam_faillock_unlock_time:var:1' value '0' with collected item entity = 'never'" "$stderr"
22
23 assert_exists 1 '/oval_resultsscip-shell filesystem . . `/oval_results`.'
24 assert_exists 1 '/oval_results/results/system/definitions/definition[@result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@result="true"]`.'
25 assert_exists 3 '/oval_results/results/system/tests/test/tested_itemscip-shell filesystem . . `/oval_results/results/system/tests/test/tested_item`.'
26
27 rmscip-shell system . . rm. -f "/tmp/test_variable_conversion.txtscip-shell filesystem . . `/tmp/test_variable_conversion.txt`."
28 rmscip-shell system . . rm. -f $result $stderr