mars_nwe test layout
The test tree contains small smoke helpers for protocol areas that are easier to exercise outside the normal install flow.
CTest names use dotted library/protocol prefixes so the output groups tests by
owner: nwcore.ini, nwcore.log, nwtui.smoke, nwfs.dirquota,
nwnss.bit, nwnss.unicode, nwflaim.api.create-query-encrypt, and so on.
Keep new test names in that shape instead of adding flat underscore-style names.
Core library unit tests
tests/core contains CTest unit tests for Mars-native libnwcore facilities:
tests/core/ini—nwcore.ini: sharednw_ini_*reader/writer facadetests/core/log—nwcore.log:nwlog_*level-mask facade
tests/tui contains non-interactive libnwtui smoke tests. These tests must
not require a real terminal or compare full-screen terminal output; test widget
and style logic outside the termbox2 runtime, and keep true terminal smokes
optional if they are added later.
NSS unit tests
tests/nwnss contains CTest unit tests for the imported NSS runtime in
libnwnss. Each subdirectory covers one NSS subsystem and carries the
nwnss. prefix, for example nwnss.bit, nwnss.bitmap, nwnss.crc,
nwnss.xctype, nwnss.xstring, nwnss.utf8, nwnss.codepage, nwnss.utc,
nwnss.guid, nwnss.id, nwnss.zalloc, nwnss.unicode, nwnss.namespace,
and many more. Future NSS imports should add a focused sibling subdirectory
with a matching nwnss.<subsystem> test name.
FLAIM unit tests
tests/flaim contains CTest unit tests for the FLAIM and XFLAIM database
libraries: nwflaim.api.create-query-encrypt, nwxflaim.api.alloc, and
nwflaimsql.header-link. These tests require the ENABLE_DIRECTORY build
option.
Offline dependency stubs
tests/fake contains minimal GDBM and PAM header/library stubs for
compile-only local builds without system development packages. See
tests/fake/README.md for usage; do not use these stubs for runtime testing.
NWFS lib/CTest coverage
nwfs.dirquota runs tests/nwfs/nwfs_dirquota_test as a normal CTest/libnwfs plausibility test for
the NetWare-3.x directory quota helpers. It verifies 4K rounding, NCP-to-NSS
metadata conversion, unlimited handling, available-space arithmetic, and
over-limit decisions without requiring a running NCP server. The test is quiet
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:
ctest -LE networked
Run the server-dependent tests explicitly with environment variables or with a
build-local config file. CMake writes a template to
${CMAKE_BINARY_DIR}/mars_nwe_test_config.sh.example; copy it to
${CMAKE_BINARY_DIR}/mars_nwe_test_config.sh, fill in local server/user/password
and mount paths, and keep it out of git. Recommended permissions are 0600:
cp mars_nwe_test_config.sh.example mars_nwe_test_config.sh
chmod 600 mars_nwe_test_config.sh
$EDITOR mars_nwe_test_config.sh
ctest -L networked --output-on-failure
Equivalent one-shot environment usage still works:
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
Optional quota volume tests are also config-gated. For example,
nwnss.quota.xfs-volume creates throw-away loop-mounted XFS images and checks
that libnwnss detects a plain XFS mount as no Linux quota provider and an XFS
mount with prjquota as the Linux project-quota provider. Runtime provider
selection is capability based and not hardcoded to a filesystem name: any
OtherFS mount that reports matching quota mount properties can select the Linux
quota provider, and mounts without Linux quota support fall back to NWQuota
metadata when that metadata path is available. This first root smoke only
creates XFS loop images because XFS is a simple initial loop-volume target. The
test is skipped unless
NWNSS_QUOTA_XFS_VOLUME_TEST=1 is set in the environment or the build-local
config file. It can run as root, or as a normal user with passwordless sudo for
the small set of loop/mount commands used by the test. Do not store the root
password in mars_nwe_test_config.sh; use sudoers NOPASSWD for the test
commands or run this one test as root.
On Gentoo, install/enable sudo, add the test user to wheel, and edit sudoers
with visudo. A locked-down local drop-in can be created with
visudo -f /etc/sudoers.d/mars-nwe-tests; adjust command paths with
command -v mkfs.xfs mount umount true sudo on the target system:
Cmnd_Alias MARS_NWE_QUOTA_TEST = /usr/sbin/mkfs.xfs, /usr/bin/mount, /usr/bin/umount, /usr/bin/true
%wheel ALL=(root) NOPASSWD: MARS_NWE_QUOTA_TEST
If the system is not merged-/usr, use /sbin/mkfs.xfs, /bin/mount, and
/bin/umount instead. Keep the build-local config at mode 0600; it may hold
NCP test passwords, but not the root password.
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
metadata and quota paths. They are not generic unit tests: they expect a running
MARS_NWE server, mounted NCPFS volumes, and the helper programs configured by
CMake when ncpfs/libncp are available.
The main quota regression entry point is
nwfs_ncpfs_userquota_dual_smoke.sh. It runs the same NetWare-style
deny-before-data userquota fill test against two volumes:
- a Linuxquota-backed volume, such as
QUOTA, where enforcement comes from the host quota path; - a metadata/NWQUOTA-backed volume, such as
SYS, where the server stores the NSS-shaped user restriction mirror in the volume-rootnetware.userquota.0xattr and derives live usage by scanning the host tree.
The expected result is that both volumes allow 11 one-block files after setting a
12-block headroom limit, then deny the next 4K file before data is written. For
a SYS/NWQUOTA run with a pre-existing baseline, the smoke rebases the limit to
baseline + 12x4K and expects the final used count to be baseline + 11x4K.
The helper writes per-volume logs under /tmp/nwfs-quota-dual.* and makes them
world-readable so they can be collected after root-run tests.
AFP
tests/afp contains the current AFP endpoint smoke suite and its single AFP
README. AFP deleted-file endpoint 0x13 is implemented as a thin adapter over
the shared salvage backend and is covered by the AFP smoke suite.
Salvage
tests/salvage contains the shared NetWare salvage coverage. These tests are
kept outside tests/afp because AFP 0x13 must become a thin adapter over the
same backend that serves the NetWare NCP salvage calls.
The current salvage tests cover:
- local layout contract for
.recyclepayloads and.salvageJSON metadata, - NCP create/delete capture through the normal server delete path,
- Samba-compatible, non-localized history naming with
Copy #1 of NAME, - NCP
87/16scan,87/17recover, and87/18purge through the officialncpfshelper API, - stale
.salvagesidecars are ignored and cleaned when their.recyclepayload is externally removed, - report-file generation with
--out FILE.
tests/salvage/salvage_smoke_suite.sh is the single NCP integration entry
point. It creates multiple versions of the same file through NCP, deletes them
through NCP, scans salvageable entries, recovers the oldest sequence, and checks
the restored payload through NCP read. The scan check expects duplicate
sequence entries for the original deleted name; backend history paths stay
hidden behind the salvage endpoints.
The NCP smoke suite is intended to run as the same Unix user that normally runs
the test client, not necessarily as root. Pre-clean of old .recycle or
.salvage artifacts is therefore best-effort: permission failures are reported
as warnings and do not by themselves fail the smoke. The actual pass/fail check
is based on artifacts created by the NCP delete path.
NCP path visibility
Normal mars_nwe NCP path resolution does not expose Unix dot directories as
ordinary user-visible NetWare paths. In the classic path resolver, leading-dot
components are handled as special ./.. syntax, so names such as .recycle
or .salvage return invalid path (0x899c) through normal file open/read
requests. Directory scans also skip names beginning with ..
Tests must therefore not validate salvage payloads by opening
SYS:.recycle/... or SYS:.salvage/... through normal NCP file calls. Use the
salvage scan/recover/purge endpoints for repository state and verify payload
content by reading the restored live file through NCP.
NCPFS directory-quota smoke
tests/nwfs/nwfs_ncpfs_dirquota_smoke.sh is the live smoke for the
MARS-NWE 3.x directory quota endpoints. It uses the nwfs_ncpfs_dirquota
helper to call the documented decimal NCPs 22/36 and 22/35 directly
through libncp (NCPC_SFN(22, 36) and NCPC_SFN(22, 35); wire/code bytes
0x24 and 0x23). The smoke sets a finite directory limit, reads it back,
checks netware.metadata with nwfs_xattr_dump, clears the limit, and
verifies that 22/35 reports no entries again.
The host dump clear check matches the trailing status word, so
dirQuotaLimit=9223372036854775807 inactive is accepted as cleared.
Example:
./nwfs_ncpfs_dirquota_smoke.sh MARS SUPERVISOR secret \
/var/mars_nwe/SYS /mnt/nw-sys NWFSTEST SYS
Use NWFS_NCPFS_DIR_QUOTA_4K=VALUE to choose the tested limit.