@@ -97,6 +97,12 @@ $ cmake ../
9797$ make
9898----
9999
100+ If you reuse an existing build tree after a Perl upgrade or package-manager
101+ change, CMake may retain stale `PERL_INCLUDE_PATH` or `PERL_LIBRARY` cache
102+ entries. The top-level build now clears cached Perl paths that no longer exist,
103+ so rerunning `cmake ../` in the same build directory is usually sufficient.
104+ If Perl detection still looks wrong, remove `CMakeCache.txt` and reconfigure.
105+
100106On Ubuntu 18.04 and potentially other distro, the python3 dist-packages path is wrong.
101107If the following command:
102108
@@ -168,6 +174,43 @@ Now you can execute the following command to run library self-checks:
168174$ ctest
169175----
170176
177+ For containerized Linux validation, start a local MTA and provide a session
178+ D-Bus before invoking the full suite so MITRE, `fwupd`, and `systemd`-related
179+ coverage stays active:
180+
181+ ----
182+ $ postfix start
183+ $ dbus-run-session -- ctest --output-on-failure
184+ ----
185+
186+ The test suite supports filtering by labels. This is useful for platform-specific
187+ or subsystem-specific runs:
188+
189+ ----
190+ $ ctest -L probes
191+ $ ctest -L api
192+ $ ctest -L unix
193+ $ ctest -L independent
194+ $ ctest -L linux_only
195+ $ ctest -L macos
196+ $ ctest -L freebsd
197+ ----
198+
199+ Labels are assigned in `tests/CMakeLists.txt` by helper functions:
200+
201+ * `add_oscap_test(script.sh [LABELS ...])`:
202+ ** registers shell-based tests,
203+ ** always adds `shell`,
204+ ** automatically adds a suite label based on the top-level test path
205+ (`api`, `probes`, `report`, `sources`, etc.),
206+ ** appends optional explicit labels (for example `unix`, `linux_only`, `macos`).
207+
208+ * `add_oscap_ctest(name COMMAND ... [LABELS ...])`:
209+ ** registers direct CTest commands (for example Python/pytest tests),
210+ ** always adds `ctest`,
211+ ** automatically adds the same top-level suite label,
212+ ** appends optional explicit labels.
213+
171214Note that using the `--jobs/-j` flag is currently not supported.
172215It will cause unexpected test failures.
173216See link:https://github.com/OpenSCAP/openscap/issues/2057[#2057] for more details.
@@ -208,6 +251,55 @@ $ docker build --tag openscap_mitre_tests:latest -f Dockerfiles/mitre_tests . &&
208251
209252--
210253
254+ == Building on macOS and FreeBSD
255+
256+ OpenSCAP can be built on macOS and FreeBSD with a reduced feature set depending
257+ on available libraries and enabled probes.
258+
259+ Typical configuration starts with:
260+
261+ ----
262+ $ mkdir -p build && cd build
263+ $ cmake .. -DENABLE_TESTS=ON -DENABLE_PROBES_LINUX=OFF
264+ $ make
265+ ----
266+
267+ Notes:
268+
269+ * Linux-specific probes (`ENABLE_PROBES_LINUX`) should be disabled on non-Linux
270+ systems unless you are explicitly cross-compiling for Linux.
271+ * Some tests are intentionally labeled `linux_only` and should be filtered out
272+ using CTest labels.
273+ * After a successful non-Linux build, `ctest -L macos` or `ctest -L freebsd`
274+ provides a quick portability smoke test without pulling in Linux-only cases.
275+ * On macOS, `SCE` is disabled by default in the main CMake configuration.
276+
277+ === Recent portability updates
278+
279+ The codebase contains recent portability work for macOS/FreeBSD, including:
280+
281+ * `sysctl` probe support for macOS (`/usr/sbin/sysctl -ae`) and FreeBSD/macOS
282+ branching, including parsing of multiline BSD `sysctl -ae` values by treating
283+ only valid `name=value` headers as new items,
284+ * `memusage` support on macOS via Mach APIs,
285+ * `XCCDF` target MAC collection on macOS via `AF_LINK`,
286+ * fallback parser for password probe offline mode on systems without
287+ `fgetpwent(3)`,
288+ * shadow probe offline mode explicitly marked unsupported on platforms where
289+ the Linux-style shadow path does not apply,
290+ * runlevel probe behavior explicitly marked unsupported on macOS/FreeBSD
291+ (SysV runlevels are Linux/Solaris specific).
292+
293+ Targeted regression tests for these portability areas are located in:
294+
295+ * `tests/API/XCCDF/unittests/test_xccdf_result_sysinfo_platform.sh`
296+ * `tests/API/probes/test_memusage_platform.sh`
297+ * `tests/probes/password/test_probes_password_offline_fallback.sh`
298+ * `tests/probes/runlevel/test_probes_runlevel_unsupported.sh`
299+ * `tests/probes/shadow/test_probes_shadow_offline_unsupported.sh`
300+ * `tests/probes/sysctl/test_sysctl_probe.sh`
301+ * `tests/probes/sysctl/test_sysctl_probe_all.sh`
302+
211303. *Install*
212304+
213305--
@@ -369,4 +461,3 @@ For more information about OpenSCAP library, you can refer to this online
369461reference manual: http://static.open-scap.org/openscap-1.2/[OpenSCAP
370462reference manual]. This manual is included in a release tarball and can be
371463regenerated from project sources by Doxygen documentation system.
372-
0 commit comments