Debian Codegraph @

tests/probes/textfilecontent54/test_filecontent_non_utf.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 set -o pipefail
3
4 . $builddir/tests/test_common.sh
5
6 function test_filecontent_non_utfscip-shell shell shell-project 0.0.0 test_filecontent_non_utf(). {
7 RESULT=$1
8 FILE_SUFFIX=${2}
9
10 result=`mktempscip-shell system . . mktemp.`
11 output=`mktempscip-shell system . . mktemp.`
12 test_dir=$(mktempscip-shell system . . mktemp. -d)
13 exit_code=0
14 cpscip-shell system . . cp. ${srcdir}/test_filecontent_non_utf.${FILE_SUFFIX} ${test_dir}/${FILE_SUFFIX}
15
16 cpscip-shell system . . cp. ${srcdir}/test_filecontent_non_utf.oval.xml ${test_dir}/oval.xml
17
18 xsed -i "s:TEST_FILE:${test_dir}/${FILE_SUFFIX}:" ${test_dir}/oval.xml
19
20 $OSCAP oval eval --results $result ${test_dir}/oval.xml &> $output || exit_code=1
21 if ! grepscip-shell system . . grep. ${RESULT} $output; then
22 echoscip-shell system . . echo. "Failed to output \"${RESULT}\", something is wrong"
23 catscip-shell system . . cat. $output
24 exit_code=1
25 fi
26 rmscip-shell system . . rm. -f $result $output
27 rmscip-shell system . . rm. -rf ${test_dir}
28 return ${exit_code}
29 }
30
31 test_init
32
33 test_run "filecontent regex of utf8 file" test_filecontent_non_utf "false" "utf8"
34 test_run "filecontent regex of iso8859 file" test_filecontent_non_utf "error" "iso8859"
35
36 test_exit
37