Skip to content

Commit 8ac6ac9

Browse files
author
Bryan Schneiders
committed
replace file check with probecheck
1 parent 8e48415 commit 8ac6ac9

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

tests/DS/test_ds_misc.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ sds_add_multiple_twice(){
7676
}
7777

7878
function test_eval {
79+
probecheck "rpminfo" || return 255
7980
local stderr=$(mktemp -t ${name}.out.XXXXXX)
8081
$OSCAP xccdf eval "${srcdir}/$1" 2> $stderr
8182
diff /dev/null $stderr; rm $stderr
@@ -164,15 +165,6 @@ function test_eval_complex()
164165
rm $arf
165166
}
166167

167-
function test_eval_depends {
168-
# only run test if dependency file exists
169-
if [ -f "$2" ]; then
170-
return test_eval $1
171-
else
172-
return 255
173-
fi
174-
}
175-
176168
function test_oval_eval {
177169

178170
$OSCAP oval eval "${srcdir}/$1"
@@ -251,6 +243,7 @@ test_run "sds_external_xccdf" test_sds_external_xccdf sds_external_xccdf sds_ext
251243
test_run "sds_tailoring" test_sds_tailoring sds_tailoring sds_tailoring/sds.ds.xml scap_com.example_datastream_with_tailoring xccdf_com.example_cref_tailoring_01 xccdf_com.example_profile_tailoring
252244

253245
test_run "eval_simple" test_eval eval_simple/sds.xml
246+
test_run "cpe_in_ds" test_eval cpe_in_ds/sds.xml
254247
test_run "eval_invalid" test_invalid_eval eval_invalid/sds.xml
255248
test_run "eval_invalid_oval" test_invalid_oval_eval eval_invalid/sds-oval.xml
256249
test_run "eval_xccdf_id1" test_eval_id eval_xccdf_id/sds.xml scap_org.open-scap_datastream_tst scap_org.open-scap_cref_first-xccdf.xml first
@@ -267,7 +260,6 @@ test_run "test_eval_complex" test_eval_complex
267260
test_run "sds_add_multiple_oval_twice_in_row" sds_add_multiple_twice
268261
test_run "test_ds_1_2_continue_without_remote_resources" test_ds_continue_without_remote_resources ds_continue_without_remote_resources/remote_content_1.2.ds.xml xccdf_com.example.www_profile_test_remote_res
269262
test_run "test_ds_1_3_continue_without_remote_resources" test_ds_continue_without_remote_resources ds_continue_without_remote_resources/remote_content_1.3.ds.xml xccdf_com.example.www_profile_test_remote_res
270-
test_run "cpe_in_ds" test_eval_depends cpe_in_ds/sds.xml /etc/sysconfig/prelink
271263

272264
test_exit
273265

tests/DS/test_sds_eval.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set -e -o pipefail
1111
# Test Cases.
1212

1313
function test_eval {
14+
probecheck "rpminfo" || return 255
1415
local stderr=$(mktemp -t ${name}.out.XXXXXX)
1516
$OSCAP xccdf eval "${srcdir}/$1" 2> $stderr
1617
diff /dev/null $stderr; rm $stderr
@@ -99,15 +100,6 @@ function test_eval_complex()
99100
rm $arf
100101
}
101102

102-
function test_eval_depends {
103-
# only run test if dependency file exists
104-
if [ -f "$2" ]; then
105-
return test_eval $1
106-
else
107-
return 255
108-
fi
109-
}
110-
111103
function test_oval_eval {
112104

113105
$OSCAP oval eval "${srcdir}/$1"
@@ -171,6 +163,7 @@ test_run "sds_external_xccdf" test_sds_external_xccdf sds_external_xccdf sds_ext
171163
test_run "sds_tailoring" test_sds_tailoring sds_tailoring sds_tailoring/sds.ds.xml scap_com.example_datastream_with_tailoring xccdf_com.example_cref_tailoring_01 xccdf_com.example_profile_tailoring
172164

173165
test_run "eval_simple" test_eval eval_simple/sds.xml
166+
test_run "cpe_in_ds" test_eval cpe_in_ds/sds.xml
174167
test_run "eval_invalid" test_invalid_eval eval_invalid/sds.xml
175168
test_run "eval_invalid_oval" test_invalid_oval_eval eval_invalid/sds-oval.xml
176169
test_run "eval_xccdf_id1" test_eval_id eval_xccdf_id/sds.xml scap_org.open-scap_datastream_tst scap_org.open-scap_cref_first-xccdf.xml first
@@ -184,6 +177,5 @@ test_run "eval_oval_id2" test_oval_eval_id eval_oval_id/sds.xml scap_org.open-sc
184177
test_run "eval_cpe" test_eval_cpe eval_cpe/sds.xml
185178

186179
test_run "test_eval_complex" test_eval_complex
187-
test_run "cpe_in_ds" test_eval_depends cpe_in_ds/sds.xml /etc/sysconfig/prelink
188180

189181
test_exit

0 commit comments

Comments
 (0)