@@ -168,6 +168,34 @@ Now you can execute the following command to run library self-checks:
168168$ ctest
169169----
170170
171+ The test suite supports filtering by labels. This is useful for platform-specific
172+ or subsystem-specific runs:
173+
174+ ----
175+ $ ctest -L probes
176+ $ ctest -L api
177+ $ ctest -L unix
178+ $ ctest -L independent
179+ $ ctest -L linux_only
180+ $ ctest -L macos
181+ $ ctest -L freebsd
182+ ----
183+
184+ Labels are assigned in `tests/CMakeLists.txt` by helper functions:
185+
186+ * `add_oscap_test(script.sh [LABELS ...])`:
187+ ** registers shell-based tests,
188+ ** always adds `shell`,
189+ ** automatically adds a suite label based on the top-level test path
190+ (`api`, `probes`, `report`, `sources`, etc.),
191+ ** appends optional explicit labels (for example `unix`, `linux_only`, `macos`).
192+
193+ * `add_oscap_ctest(name COMMAND ... [LABELS ...])`:
194+ ** registers direct CTest commands (for example Python/pytest tests),
195+ ** always adds `ctest`,
196+ ** automatically adds the same top-level suite label,
197+ ** appends optional explicit labels.
198+
171199Note that using the `--jobs/-j` flag is currently not supported.
172200It will cause unexpected test failures.
173201See link:https://github.com/OpenSCAP/openscap/issues/2057[#2057] for more details.
@@ -208,6 +236,46 @@ $ docker build --tag openscap_mitre_tests:latest -f Dockerfiles/mitre_tests . &&
208236
209237--
210238
239+ == Building on macOS and FreeBSD
240+
241+ OpenSCAP can be built on macOS and FreeBSD with a reduced feature set depending
242+ on available libraries and enabled probes.
243+
244+ Typical configuration starts with:
245+
246+ ----
247+ $ mkdir -p build && cd build
248+ $ cmake .. -DENABLE_TESTS=ON -DENABLE_PROBES_LINUX=OFF
249+ $ make
250+ ----
251+
252+ Notes:
253+
254+ * Linux-specific probes (`ENABLE_PROBES_LINUX`) should be disabled on non-Linux
255+ systems unless you are explicitly cross-compiling for Linux.
256+ * Some tests are intentionally labeled `linux_only` and should be filtered out
257+ using CTest labels.
258+ * On macOS, `SCE` is disabled by default in the main CMake configuration.
259+
260+ === Recent portability updates
261+
262+ The codebase contains recent portability work for macOS/FreeBSD, including:
263+
264+ * `sysctl` probe support for macOS (`/usr/sbin/sysctl -ae`) and FreeBSD/macOS
265+ branching,
266+ * `memusage` support on macOS via Mach APIs,
267+ * `XCCDF` target MAC collection on macOS via `AF_LINK`,
268+ * fallback parser for password probe offline mode on systems without
269+ `fgetpwent(3)`,
270+ * runlevel probe behavior explicitly marked unsupported on macOS/FreeBSD
271+ (SysV runlevels are Linux/Solaris specific).
272+
273+ Targeted regression tests for these portability areas are located in:
274+
275+ * `tests/API/probes/test_memusage_platform.sh`
276+ * `tests/probes/password/test_probes_password_offline_fallback.sh`
277+ * `tests/probes/sysctl/test_sysctl_probe.sh`
278+
211279. *Install*
212280+
213281--
0 commit comments