Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
working-directory: ./build
run: |
export $(dbus-launch)
ctest --output-on-failure
ctest --output-on-failure -j$(nproc)

build-fedora:
name: Build, Test on Fedora Latest (Container)
Expand All @@ -70,7 +70,7 @@ jobs:
working-directory: ./build
run: |
export $(dbus-launch)
ctest --output-on-failure
ctest --output-on-failure -j$(nproc)

build-fedora-nss:
name: Build, Test on Fedora Rawhide (NSS) (Container)
Expand All @@ -93,7 +93,7 @@ jobs:
working-directory: ./build
run: |
export $(dbus-launch)
ctest --output-on-failure
ctest --output-on-failure -j$(nproc)

build-macos:
# The type of runner that the job will run on
Expand Down
4 changes: 0 additions & 4 deletions docs/developer/developer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ Now you can execute the following command to run library self-checks:
$ ctest
----

Note that using the `--jobs/-j` flag is currently not supported.
It will cause unexpected test failures.
See link:https://github.com/OpenSCAP/openscap/issues/2057[#2057] for more details.

It's also possible to use `ctest` to test any other oscap binary present in the system. You just have to set the path of the binary to the CUSTOM_OSCAP variable:

----
Expand Down
6 changes: 6 additions & 0 deletions tests/API/OVAL/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ add_oscap_test("test_variable_in_filter.sh")
add_oscap_test("test_without_syschars.sh")
add_oscap_test("test_xmlns_missing.sh")
add_oscap_test("test_xsinil_envv58_pid.sh")

set_tests_properties(
"API/OVAL/unittests/test_state_check_existence.sh"
"API/OVAL/unittests/test_statetype_operator.sh"
PROPERTIES RESOURCE_LOCK tmp_foo_file_lock
)
7 changes: 7 additions & 0 deletions tests/API/XCCDF/applicability/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ add_oscap_test("test_remediate_fix_notapplicable.sh")
add_oscap_test("test_remediate_fix_processing.sh")
add_oscap_test("test_remediate_fix_processing_ds.sh")
add_oscap_test("test_report_anaconda_fixes.sh")

set_tests_properties(
"API/XCCDF/applicability/test_remediate_fix_processing_ds.sh"
"API/XCCDF/applicability/test_remediate_fix_processing.sh"
"API/XCCDF/applicability/test_remediate_fix_notapplicable.sh"
PROPERTIES RESOURCE_LOCK test_file_lock
)
38 changes: 38 additions & 0 deletions tests/API/XCCDF/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,41 @@ add_oscap_test("test_single_line_tailoring.sh")
add_oscap_test("test_reference.sh")
add_oscap_test("test_remediation_bootc.sh")
add_oscap_test("openscap_2289_regression.sh")

set_tests_properties(
"API/XCCDF/unittests/test_deriving_xccdf_result_from_oval2.sh"
"API/XCCDF/unittests/test_deriving_xccdf_result_from_oval_multicheck.sh"
"API/XCCDF/unittests/test_deriving_xccdf_result_from_oval.sh"
"API/XCCDF/unittests/test_fix_arf.sh"
"API/XCCDF/unittests/test_multiple_oval_files_with_same_basename.sh"
"API/XCCDF/unittests/test_xccdf_check_multi_check2.sh"
"API/XCCDF/unittests/test_xccdf_check_processing_complex_priority.sh"
"API/XCCDF/unittests/test_xccdf_check_processing_selector_bad.sh"
"API/XCCDF/unittests/test_xccdf_selectors_cluster2.sh"
"API/XCCDF/unittests/test_xccdf_selectors_cluster3.sh"
PROPERTIES RESOURCE_LOCK not_executable_file
)

set_tests_properties(
"API/XCCDF/unittests/test_fix_instance.sh"
"API/XCCDF/unittests/test_profile_selection_by_suffix.sh"
"API/XCCDF/unittests/test_remediate_perl.sh"
"API/XCCDF/unittests/test_remediate_simple.sh"
"API/XCCDF/unittests/test_remediate_unresolved.sh"
"API/XCCDF/unittests/test_remediation_amp_escaping.sh"
"API/XCCDF/unittests/test_remediation_bad_fix.sh"
"API/XCCDF/unittests/test_remediation_cdata.sh"
"API/XCCDF/unittests/test_remediation_environment.sh"
"API/XCCDF/unittests/test_remediation_fix_without_system.sh"
"API/XCCDF/unittests/test_remediation_invalid_characters.sh"
"API/XCCDF/unittests/test_remediation_simple.sh"
"API/XCCDF/unittests/test_remediation_subs_plain_text_empty.sh"
"API/XCCDF/unittests/test_remediation_subs_plain_text.sh"
"API/XCCDF/unittests/test_remediation_subs_unresolved.sh"
"API/XCCDF/unittests/test_remediation_subs_value_refine_value.sh"
"API/XCCDF/unittests/test_remediation_subs_value_take_first.sh"
"API/XCCDF/unittests/test_remediation_subs_value_title.sh"
"API/XCCDF/unittests/test_remediation_subs_value_without_selector.sh"
"API/XCCDF/unittests/test_remediation_xml_comments.sh"
PROPERTIES RESOURCE_LOCK test_file_lock
)
2 changes: 1 addition & 1 deletion tests/API/XCCDF/unittests/test_remediation_blueprint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo "Result file = $result"
# The expected file was generated without ' # This file was generated by OpenSCAP 1.3.5 using:' line
# to make the test independent from the scanner version. We have to filter this line from the output as well.

$OSCAP xccdf generate fix --fix-type blueprint --profile 'common' "$input_xml" | grep -v "OpenSCAP" > "$result"
$OSCAP xccdf generate fix --fix-type blueprint --profile 'common' "$input_xml" | grep -v "OpenSCAP " > "$result"

diff "$expected_result" "$result"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -o pipefail

function test_xccdf_results_arf_asset {
local DS="${srcdir}/test_xccdf_results_arf_no_oval.xccdf.xml"
local result="results.xml"
local result="$(mktemp results.XXXXXXX.xml)"
local stderr="error.log"

[ -f $result ] && rm -f $result
Expand Down
2 changes: 1 addition & 1 deletion tests/curl/test_curl_encoding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function curl_accept_encoding {
require_internet || return 255

local DF="${srcdir}/ds.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"
local LOG="verbose.log"

$OSCAP xccdf --verbose=DEVEL eval --fetch-remote-resources --results $RF $DF 2>$LOG || echo "OK"
Expand Down
2 changes: 1 addition & 1 deletion tests/probes/family/test_probes_family.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function test_probes_family {

local ret_val=0;
local DF="${srcdir}/test_probes_family.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down
6 changes: 3 additions & 3 deletions tests/probes/file/test_probes_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function test_probes_file {

local ret_val=0;
local DF="$srcdir/test_probes_file.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down Expand Up @@ -50,7 +50,7 @@ function test_probes_file_filenames {

local ret_val=0
local DF="$srcdir/test_probes_file_filename.xml"
result="results.xml"
result="$(mktemp results.XXXXXXX.xml)"
files_dir=$(mktemp -d)
DF_INJECTED=$(mktemp)

Expand Down Expand Up @@ -95,7 +95,7 @@ function test_probes_file_invalid_utf8 {

local ret_val=0
local DF="$srcdir/test_probes_file_filename.xml"
result="results.xml"
result="$(mktemp results.XXXXXXX.xml)"
files_dir=$(mktemp -d)
DF_INJECTED=$(mktemp)

Expand Down
2 changes: 1 addition & 1 deletion tests/probes/file/test_probes_file_behaviour.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function test_probes_file_behaviour {

local ret_val=0
local DF="$srcdir/test_probes_file_behaviour.xml"
result="results.xml"
result="$(mktemp results.XXXXXXX.xml)"

test_probes_behaviour_setup

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function test_probes_fileextendedattribute {

local ret_val=0;
local DEFFILE="$srcdir/test_probes_fileextendedattribute.xml"
local RESFILE="results.xml"
local RESFILE="$(mktemp results.XXXXXXX.xml)"

[ -f $RESFILE ] && rm -f $RESFILE

Expand Down
2 changes: 1 addition & 1 deletion tests/probes/filehash/test_probes_filehash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function test_probes_filehash {

local ret_val=0;
local DF="test_probes_filehash.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down
4 changes: 2 additions & 2 deletions tests/probes/filehash58/test_probes_filehash58.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function test_probes_filehash58_old_algos {

local ret_val=0;
local DF="test_probes_filehash58_old_algos.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down Expand Up @@ -52,7 +52,7 @@ function test_probes_filehash58_new_algos {

local ret_val=0
local DF="test_probes_filehash58_new_algos.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down
2 changes: 1 addition & 1 deletion tests/probes/filemd5/test_probes_filemd5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function test_probes_filemd5 {

local ret_val=0;
local DEFFILE="test_probes_filemd5.xml"
local RESFILE="results.xml"
local RESFILE="$(mktemp results.XXXXXXX.xml)"

[ -f $RESFILE ] && rm -f $RESFILE

Expand Down
2 changes: 1 addition & 1 deletion tests/probes/fwupdsecattr/test_probes_fwupdsecattr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function test_probes_fwupdsecattr {

local ret_val=0
local DF="${srcdir}/test_probes_fwupdsecattr.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function test_probes_fwupdsecattr {

local ret_val=0
local DF="${srcdir}/test_probes_fwupdsecattr_mock.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"
local DBUS_MOCK_NAME="org.freedesktop.fwupd"
local stderr=$(mktemp test_probes_fwupdsecattr_mock.err.XXXXXX)
echo "stderr file: $stderr"
Expand Down
2 changes: 1 addition & 1 deletion tests/probes/interface/test_probes_interface.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function test_probes_interface {

local ret_val=0;
local DF="test_probes_interface.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down
2 changes: 1 addition & 1 deletion tests/probes/isainfo/test_probes_isainfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function test_probes_isainfo {

local ret_val=0;
local DF="test_probes_isainfo.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down
2 changes: 1 addition & 1 deletion tests/probes/password/test_probes_password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function test_probes_password {

local ret_val=0;
local DF="test_probes_password.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down
2 changes: 1 addition & 1 deletion tests/probes/password/test_probes_password_offline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function test_probes_password {

local ret_val=0;
local DF="${srcdir}/test_probes_password_offline.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down
6 changes: 6 additions & 0 deletions tests/probes/rpm/rpminfo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
if(ENABLE_PROBES_LINUX)
add_oscap_test("test_probes_rpminfo.sh")
add_oscap_test("test_probes_rpminfo_offline.sh")

set_tests_properties(
"probes/rpm/rpminfo/test_probes_rpminfo_offline.sh"
"probes/rpm/rpminfo/test_probes_rpminfo.sh"
PROPERTIES RESOURCE_LOCK rpm_shared
)
endif()
4 changes: 2 additions & 2 deletions tests/probes/rpm/rpminfo/rpminfo_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function test_probes_rpminfo {

local ret_val=0;
local DF="test_probes_rpminfo.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

rm -f $RF

Expand All @@ -50,4 +50,4 @@ function test_probes_rpminfo {
rm -f $RF $DF

return $ret_val
}
}
6 changes: 6 additions & 0 deletions tests/probes/rpm/rpmverify/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
if(ENABLE_PROBES_LINUX)
add_oscap_test("test_probes_rpmverify_not_equals_operation.sh")
add_oscap_test("test_probes_rpmverify_not_equals_operation_offline.sh")

set_tests_properties(
"probes/rpm/rpmverify/test_probes_rpmverify_not_equals_operation_offline.sh"
"probes/rpm/rpmverify/test_probes_rpmverify_not_equals_operation.sh"
PROPERTIES RESOURCE_LOCK rpm_shared
)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function perform_test {
rpm -qf /root || return 255

DF="$srcdir/test_probes_rpmverify_not_equals_operation.xml"
RF="results.xml"
RF="$(mktemp results.XXXXXXX.xml)"

rm -f $RF

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function perform_test {
probecheck "rpmverify" || return 255

DF="$srcdir/test_probes_rpmverify_not_equals_operation_offline.xml"
RF="results.xml"
RF="$(mktemp results.XXXXXXX.xml)"

rm -f $RF

Expand Down
7 changes: 7 additions & 0 deletions tests/probes/rpm/rpmverifyfile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@ if(ENABLE_PROBES_LINUX)
add_oscap_test("test_probes_rpmverifyfile.sh")
add_oscap_test("test_probes_rpmverifyfile_older.sh")
add_oscap_test("test_probes_rpmverifyfile_offline.sh")

set_tests_properties(
"probes/rpm/rpmverifyfile/test_probes_rpmverifyfile_offline.sh"
"probes/rpm/rpmverifyfile/test_probes_rpmverifyfile_older.sh"
"probes/rpm/rpmverifyfile/test_probes_rpmverifyfile.sh"
PROPERTIES RESOURCE_LOCK rpm_shared
)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function test_probes_rpmverifyfile {
require "rpm" || return 255

DF="$srcdir/test_probes_rpmverifyfile.xml"
RF="results.xml"
RF="$(mktemp results.XXXXXXX.xml)"

rm -f $RF

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function test_probes_rpmverifyfile {
probecheck "rpmverifyfile" || return 255

DF="$srcdir/test_probes_rpmverifyfile_offline.xml"
RF="results.xml"
RF="$(mktemp results.XXXXXXX.xml)"

rm -f $RF

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function test_probes_rpmverifyfile {
require "rpm" || return 255

DF="$srcdir/test_probes_rpmverifyfile_older.xml"
RF="results.xml"
RF="$(mktemp results.XXXXXXX.xml)"

rm -f $RF

Expand Down
6 changes: 6 additions & 0 deletions tests/probes/rpm/rpmverifypackage/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
if(ENABLE_PROBES_LINUX)
add_oscap_test("test_probes_rpmverifypackage.sh")
add_oscap_test("test_probes_rpmverifypackage_offline.sh")

set_tests_properties(
"probes/rpm/rpmverifypackage/test_probes_rpmverifypackage_offline.sh"
"probes/rpm/rpmverifypackage/test_probes_rpmverifypackage.sh"
PROPERTIES RESOURCE_LOCK rpm_shared
)
endif()
2 changes: 1 addition & 1 deletion tests/probes/shadow/test_probes_shadow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function test_probes_shadow {

local ret_val=0;
local DF="test_probes_shadow.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down
2 changes: 1 addition & 1 deletion tests/probes/shadow/test_probes_shadow_offline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function test_probes_shadow {

local ret_val=0;
local DF="${srcdir}/test_probes_shadow_offline.xml"
local RF="results.xml"
local RF="$(mktemp results.XXXXXXX.xml)"

[ -f $RF ] && rm -f $RF

Expand Down
Loading
Loading