diff --git a/AI.md b/AI.md index 9955165..e19eef1 100644 --- a/AI.md +++ b/AI.md @@ -517,3 +517,14 @@ for further namespace implementation and NCP structure verification: - `ncp__enu.pdf` - `websdk.tar.gz` - `include.tar.gz` + +### Networked CTest skip policy + +Server-dependent NCPFS/AFP/salvage/quota smokes must be visible in CTest but +must not fail ordinary offline builds. Register them with the +`networked;integration` labels and `SKIP_RETURN_CODE 77`. The test launcher +prints `SKIP/WARN` and exits 77 unless `MARS_NWE_RUN_NETWORKED_TESTS=1` and the +required `MARS_NWE_TEST_*` environment variables are present. Use +`ctest -LE networked` for offline unit coverage and `ctest -L networked` for +server-backed integration runs. When the TCP/IP transport test harness lands, +these CTest entries become the path for real local execution. diff --git a/TODO.md b/TODO.md index b042e73..a39d13d 100644 --- a/TODO.md +++ b/TODO.md @@ -376,3 +376,14 @@ Concrete follow-up for the future facade: preservation policy and legacy `nw.ini` adapters. - Extend `nwlog_*` beyond stderr/file-friendly output toward syslog, journald-friendly output, GELF and JSON-lines/Filebeat-style forwarding. + +### Networked CTest skip policy + +Server-dependent NCPFS/AFP/salvage/quota smokes must be visible in CTest but +must not fail ordinary offline builds. Register them with the +`networked;integration` labels and `SKIP_RETURN_CODE 77`. The test launcher +prints `SKIP/WARN` and exits 77 unless `MARS_NWE_RUN_NETWORKED_TESTS=1` and the +required `MARS_NWE_TEST_*` environment variables are present. Use +`ctest -LE networked` for offline unit coverage and `ctest -L networked` for +server-backed integration runs. When the TCP/IP transport test harness lands, +these CTest entries become the path for real local execution. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cbed6f8..602f9a5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,6 +5,19 @@ # protocol test groups in the same way src/CMakeLists.txt fans out to source # subdirectories. +set(MARS_NWE_NETWORKED_CTEST_GATE ${CMAKE_BINARY_DIR}/tests/networked_ctest_gate.sh) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/networked_ctest_gate.sh.in + ${MARS_NWE_NETWORKED_CTEST_GATE} + @ONLY +) +file(CHMOD ${MARS_NWE_NETWORKED_CTEST_GATE} + PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE) + + if(MARS_NWE_BUILD_TESTS) add_subdirectory(core) add_subdirectory(nwnss) diff --git a/tests/README.md b/tests/README.md index 6288879..e8acbc5 100644 --- a/tests/README.md +++ b/tests/README.md @@ -53,6 +53,43 @@ on success for CTest; run the built `nwfs_dirquota_test -h` executable for usage or `nwfs_dirquota_test -v` for a short success line. Use `ldd`, not `ld`, to inspect the executable's shared-library dependencies. + +## Networked / server-dependent CTest entries + +NCPFS, AFP, salvage, and quota smokes that need a running mars_nwe or real +Novell/OES/NSS server are registered in CTest with the labels +`networked;integration`. They are intentionally gated: offline developer +builds list them, but they print `SKIP/WARN` and exit with CTest skip code 77 +unless `MARS_NWE_RUN_NETWORKED_TESTS=1` is set. This gives the test report a +warning-like skipped entry instead of making normal offline builds fail. + +Run only offline tests with: + +```sh +ctest -LE networked +``` + +Run the server-dependent tests explicitly with: + +```sh +MARS_NWE_RUN_NETWORKED_TESTS=1 \ +MARS_NWE_TEST_SERVER=MARS \ +MARS_NWE_TEST_ADMIN=SUPERVISOR \ +MARS_NWE_TEST_PASSWORD=secret \ +MARS_NWE_TEST_SYSROOT=/var/mars_nwe/SYS \ +MARS_NWE_TEST_SYS_MOUNT=/mnt/nw-sys \ +ctest -L networked --output-on-failure +``` + +Quota-dual/all smokes additionally need `MARS_NWE_TEST_QUOTA_SYSROOT` and +`MARS_NWE_TEST_QUOTA_MOUNT`; optional variables include +`MARS_NWE_TEST_DIR`, `MARS_NWE_TEST_SYS_VOLUME`, `MARS_NWE_TEST_QUOTA_VOLUME`, +`MARS_NWE_TEST_NW_LOG`, `MARS_NWE_TEST_AFP_PATH`, +`MARS_NWE_TEST_AFP_UNIX_PATH`, `MARS_NWE_TEST_SALVAGE_PATH`, and +`MARS_NWE_TEST_SALVAGE_UNIX_PATH`. Once the TCP/IP transport is available in +the local harness, these same CTest entries can be run regularly instead of +being skipped by default. + ## NWFS/NCPFS quota and metadata smokes `tests/nwfs` contains manual NCPFS-based smoke helpers for the NetWare filesystem diff --git a/tests/afp/CMakeLists.txt b/tests/afp/CMakeLists.txt index 4df6fc3..52ff354 100644 --- a/tests/afp/CMakeLists.txt +++ b/tests/afp/CMakeLists.txt @@ -94,3 +94,20 @@ target_link_libraries(afp_temp_dir_handle_smoke ${NCPFS_LIBRARY}) add_executable(afp_set_file_info_smoke afp_set_file_info_smoke.c) target_include_directories(afp_set_file_info_smoke PRIVATE ${NCPFS_INCLUDE_DIR}) target_link_libraries(afp_set_file_info_smoke ${NCPFS_LIBRARY}) + +add_test(NAME afp.ncp.smoke + COMMAND sh ${MARS_NWE_NETWORKED_CTEST_GATE} + afp.ncp.smoke + "a running mars-nwe server, NCPFS tools, credentials, and AFP helper binaries" + MARS_NWE_TEST_SERVER + MARS_NWE_TEST_ADMIN + MARS_NWE_TEST_PASSWORD + -- + sh -c "exec \"\$1\" -S \"\$MARS_NWE_TEST_SERVER\" -U \"\$MARS_NWE_TEST_ADMIN\" -P \"\$MARS_NWE_TEST_PASSWORD\" --path \"\${MARS_NWE_TEST_AFP_PATH:-SYS:PUBLIC/pmdflts.ini}\" --unix-path \"\${MARS_NWE_TEST_AFP_UNIX_PATH:-/var/mars_nwe/SYS/public/pmdflts.ini}\" --log \"\${MARS_NWE_TEST_NW_LOG:-/var/log/mars_nwe/nw.log}\"" + sh + ${AFP_SMOKE_SUITE_SCRIPT} +) +set_tests_properties(afp.ncp.smoke PROPERTIES + LABELS "networked;integration" + SKIP_RETURN_CODE 77 +) diff --git a/tests/networked_ctest_gate.sh.in b/tests/networked_ctest_gate.sh.in new file mode 100644 index 0000000..9b17db8 --- /dev/null +++ b/tests/networked_ctest_gate.sh.in @@ -0,0 +1,50 @@ +#!/bin/sh +# CTest gate for server-dependent mars-nwe integration smokes. +# +# Offline developer builds should still list these tests, but they should not +# fail when no mars_nwe server, NCPFS mount, credentials, or transport is +# available. CTest treats exit code 77 as skipped via SKIP_RETURN_CODE. +set -u + +SKIP_CODE=77 + +if [ "$#" -lt 3 ]; then + echo "SKIP/WARN: malformed networked CTest gate invocation" >&2 + exit "$SKIP_CODE" +fi + +TEST_NAME=$1 +DESCRIPTION=$2 +shift 2 + +RUN=${MARS_NWE_RUN_NETWORKED_TESTS:-0} +case "$RUN" in + 1|yes|true|on|YES|TRUE|ON) ;; + *) + echo "SKIP/WARN: $TEST_NAME requires $DESCRIPTION." >&2 + echo "SKIP/WARN: set MARS_NWE_RUN_NETWORKED_TESTS=1 and the required MARS_NWE_TEST_* environment before running networked CTest labels." >&2 + exit "$SKIP_CODE" + ;; +esac + +while [ "$#" -gt 0 ]; do + case "$1" in + --) + shift + break + ;; + esac + eval "VALUE=\${$1:-}" + if [ -z "$VALUE" ]; then + echo "SKIP/WARN: $TEST_NAME needs environment variable $1." >&2 + exit "$SKIP_CODE" + fi + shift +done + +if [ "$#" -eq 0 ]; then + echo "SKIP/WARN: $TEST_NAME has no command after networked CTest gate." >&2 + exit "$SKIP_CODE" +fi + +exec "$@" diff --git a/tests/nwfs/CMakeLists.txt b/tests/nwfs/CMakeLists.txt index ac9726f..9681bd6 100644 --- a/tests/nwfs/CMakeLists.txt +++ b/tests/nwfs/CMakeLists.txt @@ -83,5 +83,91 @@ foreach(NWFS_NCPFS_SMOKE_SCRIPT WORLD_READ WORLD_EXECUTE) endforeach() + +function(mars_nwe_add_networked_ctest TEST_NAME TEST_DESCRIPTION) + add_test(NAME ${TEST_NAME} + COMMAND sh ${MARS_NWE_NETWORKED_CTEST_GATE} + ${TEST_NAME} + ${TEST_DESCRIPTION} + ${ARGN} + ) + set_tests_properties(${TEST_NAME} PROPERTIES + LABELS "networked;integration" + SKIP_RETURN_CODE 77 + ) +endfunction() + +mars_nwe_add_networked_ctest(nwfs.ncpfs.metadata + "a running mars-nwe server, NCPFS tools, credentials, and a host SYS root" + MARS_NWE_TEST_SERVER + MARS_NWE_TEST_ADMIN + MARS_NWE_TEST_PASSWORD + MARS_NWE_TEST_SYSROOT + -- + sh -c "exec \"\$1\" \"\$MARS_NWE_TEST_SERVER\" \"\$MARS_NWE_TEST_ADMIN\" \"\$MARS_NWE_TEST_PASSWORD\" \"\$MARS_NWE_TEST_SYSROOT\" \"\${MARS_NWE_TEST_SYS_MOUNT:-}\" \"\${MARS_NWE_TEST_DIR:-NWFSTEST}\" \"\${MARS_NWE_TEST_SYS_VOLUME:-SYS}\"" sh + ${CMAKE_CURRENT_BINARY_DIR}/nwfs_ncpfs_metadata_smoke.sh +) + +mars_nwe_add_networked_ctest(nwfs.ncpfs.dirquota + "a running mars-nwe server, NCPFS tools, credentials, and a host volume root" + MARS_NWE_TEST_SERVER + MARS_NWE_TEST_ADMIN + MARS_NWE_TEST_PASSWORD + MARS_NWE_TEST_SYSROOT + -- + sh -c "exec \"\$1\" \"\$MARS_NWE_TEST_SERVER\" \"\$MARS_NWE_TEST_ADMIN\" \"\$MARS_NWE_TEST_PASSWORD\" \"\$MARS_NWE_TEST_SYSROOT\" \"\${MARS_NWE_TEST_SYS_MOUNT:-}\" \"\${MARS_NWE_TEST_DIR:-NWFSTEST}\" \"\${MARS_NWE_TEST_SYS_VOLUME:-SYS}\"" sh + ${CMAKE_CURRENT_BINARY_DIR}/nwfs_ncpfs_dirquota_smoke.sh +) + +mars_nwe_add_networked_ctest(nwfs.ncpfs.userquota-fill + "a running mars-nwe server, NCPFS tools, credentials, and a quota-capable host volume root" + MARS_NWE_TEST_SERVER + MARS_NWE_TEST_ADMIN + MARS_NWE_TEST_PASSWORD + MARS_NWE_TEST_SYSROOT + -- + sh -c "exec \"\$1\" \"\$MARS_NWE_TEST_SERVER\" \"\$MARS_NWE_TEST_ADMIN\" \"\$MARS_NWE_TEST_PASSWORD\" \"\$MARS_NWE_TEST_SYSROOT\" \"\${MARS_NWE_TEST_SYS_MOUNT:-}\" \"\${MARS_NWE_TEST_DIR:-NWFSTEST}\" \"\${MARS_NWE_TEST_SYS_VOLUME:-SYS}\"" sh + ${CMAKE_CURRENT_BINARY_DIR}/nwfs_ncpfs_userquota_fill_smoke.sh +) + +mars_nwe_add_networked_ctest(nwfs.ncpfs.userquota-dual + "a running mars-nwe server, NCPFS tools, credentials, QUOTA/SYS roots, and mounted NCPFS volumes" + MARS_NWE_TEST_SERVER + MARS_NWE_TEST_ADMIN + MARS_NWE_TEST_PASSWORD + MARS_NWE_TEST_QUOTA_SYSROOT + MARS_NWE_TEST_QUOTA_MOUNT + MARS_NWE_TEST_SYSROOT + MARS_NWE_TEST_SYS_MOUNT + -- + sh -c "exec \"\$1\" \"\$MARS_NWE_TEST_SERVER\" \"\$MARS_NWE_TEST_ADMIN\" \"\$MARS_NWE_TEST_PASSWORD\" \"\$MARS_NWE_TEST_QUOTA_SYSROOT\" \"\$MARS_NWE_TEST_QUOTA_MOUNT\" \"\$MARS_NWE_TEST_SYSROOT\" \"\$MARS_NWE_TEST_SYS_MOUNT\" \"\${MARS_NWE_TEST_DIR:-NWFSTEST}\" \"\${MARS_NWE_TEST_QUOTA_VOLUME:-QUOTA}\" \"\${MARS_NWE_TEST_SYS_VOLUME:-SYS}\"" sh + ${CMAKE_CURRENT_BINARY_DIR}/nwfs_ncpfs_userquota_dual_smoke.sh +) + +mars_nwe_add_networked_ctest(nwfs.ncpfs.all-quota + "a running mars-nwe server, NCPFS tools, credentials, QUOTA/SYS roots, mounted NCPFS volumes, and server log access" + MARS_NWE_TEST_SERVER + MARS_NWE_TEST_ADMIN + MARS_NWE_TEST_PASSWORD + MARS_NWE_TEST_QUOTA_SYSROOT + MARS_NWE_TEST_QUOTA_MOUNT + MARS_NWE_TEST_SYSROOT + MARS_NWE_TEST_SYS_MOUNT + -- + sh -c "exec \"\$1\" \"\$MARS_NWE_TEST_SERVER\" \"\$MARS_NWE_TEST_ADMIN\" \"\$MARS_NWE_TEST_PASSWORD\" \"\$MARS_NWE_TEST_QUOTA_SYSROOT\" \"\$MARS_NWE_TEST_QUOTA_MOUNT\" \"\$MARS_NWE_TEST_SYSROOT\" \"\$MARS_NWE_TEST_SYS_MOUNT\" \"\${MARS_NWE_TEST_DIR:-NWFSTEST}\" \"\${MARS_NWE_TEST_QUOTA_VOLUME:-QUOTA}\" \"\${MARS_NWE_TEST_SYS_VOLUME:-SYS}\" \"\${MARS_NWE_TEST_NW_LOG:-}\"" sh + ${CMAKE_CURRENT_BINARY_DIR}/nwfs_ncpfs_all_quota_smoke.sh +) + +mars_nwe_add_networked_ctest(nwfs.ncpfs.novell-quota-reference + "a real Novell/OES/NSS server, NCPFS tools, credentials, and a test volume" + MARS_NWE_TEST_SERVER + MARS_NWE_TEST_ADMIN + MARS_NWE_TEST_PASSWORD + MARS_NWE_TEST_SYS_VOLUME + -- + sh -c "exec \"\$1\" \"\$MARS_NWE_TEST_SERVER\" \"\$MARS_NWE_TEST_ADMIN\" \"\$MARS_NWE_TEST_PASSWORD\" \"\$MARS_NWE_TEST_SYS_VOLUME\" \"\${MARS_NWE_TEST_SYS_MOUNT:-}\" \"\${MARS_NWE_TEST_DIR:-NWFSTEST}\"" sh + ${CMAKE_CURRENT_BINARY_DIR}/nwfs_ncpfs_novell_quota_reference.sh +) + configure_file(nwfs_nss_namespace_import_layout_test.sh.in nwfs_nss_namespace_import_layout_test.sh @ONLY) add_test(NAME nwfs.nss.namespace-import-layout COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/nwfs_nss_namespace_import_layout_test.sh) diff --git a/tests/salvage/CMakeLists.txt b/tests/salvage/CMakeLists.txt index 05f5f4c..e8b590a 100644 --- a/tests/salvage/CMakeLists.txt +++ b/tests/salvage/CMakeLists.txt @@ -83,3 +83,21 @@ else() "Skipping salvage NCP smoke helpers: ncpfs/libncp headers or library not found" ) endif() + +if(SALVAGE_NCPFS_INCLUDE_DIR AND SALVAGE_NCPFS_LIBRARY) + add_test(NAME salvage.ncp.smoke + COMMAND sh ${MARS_NWE_NETWORKED_CTEST_GATE} + salvage.ncp.smoke + "a running mars-nwe server, NCPFS tools, credentials, and salvage helper binaries" + MARS_NWE_TEST_SERVER + MARS_NWE_TEST_ADMIN + MARS_NWE_TEST_PASSWORD + -- + sh -c "exec \"\$1\" -S \"\$MARS_NWE_TEST_SERVER\" -U \"\$MARS_NWE_TEST_ADMIN\" -P \"\$MARS_NWE_TEST_PASSWORD\" --path \"\${MARS_NWE_TEST_SALVAGE_PATH:-SYS:PUBLIC/SLVGCHK.TXT}\" --unix-path \"\${MARS_NWE_TEST_SALVAGE_UNIX_PATH:-/var/mars_nwe/SYS/public/SLVGCHK.TXT}\" --server-log \"\${MARS_NWE_TEST_NW_LOG:-/var/log/mars_nwe/nw.log}\"" sh + ${SALVAGE_SMOKE_SUITE_SCRIPT} + ) + set_tests_properties(salvage.ncp.smoke PROPERTIES + LABELS "networked;integration" + SKIP_RETURN_CODE 77 + ) +endif()