Skip to content

Commit 6fbcb17

Browse files
committed
Add shadow offline unsupported regression on macOS
1 parent c8d0b37 commit 6fbcb17

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

tests/probes/shadow/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
if(ENABLE_PROBES_UNIX)
22
add_oscap_test("test_probes_shadow.sh" LABELS unix)
33
add_oscap_test("test_probes_shadow_offline.sh" LABELS unix)
4+
add_oscap_test("test_probes_shadow_offline_unsupported.sh" LABELS unix macos)
45
endif()
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
. $builddir/tests/test_common.sh
4+
5+
set -e -o pipefail
6+
7+
function test_probes_shadow_offline_unsupported {
8+
probecheck "shadow" || return 255
9+
10+
case "$(uname)" in
11+
Darwin) ;;
12+
*) return 255 ;;
13+
esac
14+
15+
local definition="${srcdir}/test_probes_shadow_offline.xml"
16+
local results="results_unsupported.xml"
17+
[ -f "$results" ] && rm -f "$results"
18+
19+
tmpdir=$(make_temp_dir /tmp "test_offline_mode_shadow_unsupported")
20+
mkdir -p "${tmpdir}/etc"
21+
echo "root:!locked::0:99999:7:::" > "${tmpdir}/etc/shadow"
22+
set_offline_chroot_dir "${tmpdir}"
23+
24+
$OSCAP oval eval --results "$results" "$definition"
25+
26+
set_offline_chroot_dir ""
27+
rm -rf "${tmpdir}"
28+
29+
result="$results"
30+
assert_exists 1 'oval_results/results/system/definitions/definition[@definition_id="oval:1:def:1"][@result="not applicable"]'
31+
assert_exists 1 'oval_results/results/system/tests/test[@test_id="oval:1:tst:1"][@result="not applicable"]'
32+
assert_exists 1 'oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:1:obj:1"][@flag="not applicable"]'
33+
}
34+
35+
test_init
36+
37+
test_run "test_probes_shadow_offline_unsupported" test_probes_shadow_offline_unsupported
38+
39+
test_exit

0 commit comments

Comments
 (0)