166 Commits
Author SHA1 Message Date
Fred WrightandChristopher Nielsen 939ea4e72e Move test_usb to xtest/.
This is purely a header test, so it belongs in xtest/.
2025-09-24 14:48:47 -04:00
Fred WrightandChristopher Nielsen 229cea46da Remove unexpected tabs.
The preferred style convention here is two-space indent.  Tabs are
generally allowed in two cases:

1) For Makefiles, where they're required.

2) In code imported from Apple or other external sources.

In general, preexisting code has not been detabbed, but tabs had
inappropriately leaked into some recently added or modified code.
This change removes them.

TESTED:
No changes reported by "diff -b".
2025-09-24 14:48:47 -04:00
Fred WrightandChristopher Nielsen 361b32fcb2 test_clocks: Add "slow" mode for thread-time test.
This permits optionally running the thread-time test long enough to
observe 31-bit (32-bit signed) overflow in the syscall value (prior to
fixing the bug).

Thanks to Un1q32@github for the bug report.

TESTED:
Passes on all platforms.
With -SSSSS, fails without the fix, and passes with it.
2025-07-28 17:50:47 -04:00
Fred WrightandChristopher Nielsen 1b7bf5ec23 test_realpath_nonext: Add exemption for macOS 11.
In addition to the known complete brokenness of this version of
realpath() on 10.15, it's also a bit flaky on 11.x.  So we expand the
exemption to include that.

TESTED:
Passes on all platforms.
2025-07-20 13:35:46 -04:00
Fred WrightandChristopher Nielsen e416f2e3ce test_pthread_fchdir: Fix race.
Link counts for directories aren't safe to compare, since they're
actually entry counts.  This easily matters when tests are being run
in parallel, so we suppress comparing it for directories.

Also adds additional output - names of initial [f]stat() targets
(verbose only), and details of stat miscompares.

TESTED:
Now reliably passes on all platforms.
2025-07-20 13:35:46 -04:00
Fred WrightandChristopher Nielsen bbf53a5415 test_stpncpy_chk: Return to manual category.
Moving this test to the automatic category was premature.  Although it
now works fine with all the compilers normally used, it fails with GCC
10+, for as-yet-undetermined reasons.  This doesn't affect normal
usage, but it does interfere with broad-spectrum compiler testing, so
we move it back to manual, until such time as the GCC issue is sorted
out.

TESTED:
Tests pass on all platforms, including stpncpy_chk when run as a
manual test.
2025-07-20 13:35:46 -04:00
Fred WrightandChristopher Nielsen 930c666069 test_attrlist: Add tests for "at" versions.
Previously, there were no tests for the "at" versions of the
[gs]etattrlist() functions.  This implements those as a third mode in
the attrlist tests.

TESTED:
Passes on all platforms, including new tests.
2025-07-17 16:26:39 -04:00
Fred WrightandChristopher Nielsen aeefd4361e test_attrlist: Add timestamp tests.
This optionally tests various combinations of timestamp setting, and
illustrates the known OS bug related to setting atime alone on
non-APFS filesystems.

TESTED:
Passes on all platforms by default.
Optionally illustrates timestamp bugs.
2025-07-17 16:26:39 -04:00
Fred WrightandChristopher Nielsen fca16a47c0 test_attrlist: Combine f/non-f tests.
This creates a single test function for the "f" and "non-f" flavors,
reducing code duplication.  To assist with this, it also creates
"switched" wrappers for the OS functions.

It also adjusts the indentations of the messages, and adds deletion
messages.

TESTED:
Passes on all platforms.
2025-07-17 16:26:39 -04:00
Fred WrightandChristopher Nielsen 0e1b20939a test_utimens: Adjust bug-forgiveness condition.
This adjusts the condition for allowing the Apple setattrlist() bug
that doesn't correctly set atime without mtime, accepting either an
unchanged atime, or a "now" atime.  Previously, sporadic failures were
observed.

TESTED:
Passes on all platforms.
2025-07-17 16:26:39 -04:00
Fred WrightandChristopher Nielsen c0e4e97bf7 test_attrlist: Fix buffer definitions.
This test had inherited multiple misconceptions about the correct
attribute buffer format from the old test.  That didn't cause
failures, though it would have if the test had checked that the
attributes were set as intended.  The format is now correct.

TESTED:
Passes on all platforms.
2025-07-17 16:26:39 -04:00
Fred WrightandChristopher Nielsen c849f2fdb9 test_utimens: Implement quiet option.
TESTED:
Works as intended.
2025-07-17 16:26:39 -04:00
Fred WrightandChristopher Nielsen b657575f0c test_utimens: Improve UTIME_NOW checks.
This now does a proper range check on the resulting timestamp.  In the
non-APFS case, the "before" timestamp is rounded down to a one-second
boundary, to accomodate the one-second timestamp resolution.

TESTED:
Passes on all platforms.
2025-07-17 16:26:39 -04:00
Fred WrightandChristopher Nielsen 58173af4e6 test_utimensat: Move to manual.
This has been replaced by the new test_utimens.  The old version has
been retained as a manual test in case anyone wants to run it.

TESTED:
Works as manual test.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen 1efc560b24 test_utimens: New test, replacing old test_utimensat.
This is a completely rewritten test, not relying on an Apple test
written for an unpublished test framework and then kludged.

It also accommodates the correct reason for the nanoseconds mismatch
on non-APFS filesystems.

It also adds formerly missing tests for futimens().

TESTED:
Passes on all platforms.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen a0aefcb0d5 test_attrlist: Add nobuf test cases.
This adds additional test cases where the length of the attribute
buffer is zero, with and without requested attributes.  This illustrated
a bug in [f]setattrlist() in 10.5-10.7 (prior to its fix).

Also adds a nonposix variant.

TESTED:
Passes on all platforms, with fix present.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen 684fcccc38 test_packet: Make 'nofix' tests automatic.
Now that the test tolerates expected errors in 'nofix' mode, the
'nofix' tests can be automatic.

TESTED:
Tests pass on all platforms.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen b170e1e02e test_packet: Tolerate expected errors when fixes suppressed.
When the option to suppress the packet timestamp fixes is used, don't
treat the expected failures as errors.  This allows the 'nofix' tests
to be included in the automatic tests.

TESTED:
Tests pass on all platforms.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen 8e025bc9a4 test_packet: Remove obsolete compatibility hack.
This hack was only needed prior to the new time.c, and should have
been removed once that was merged.

TESTED:
Tests pass on all platforms.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen 1cb025bd9d test_stpncpy_chk: Return to automatic.
Due to some other changes, these tests are no longer problematic, and
no longer need to be relegated to the manual category.

The similar strncpy_chk tests are still excessively warning-prone, but
the feature they test has never been provided by legacy-support, and
they were only added to provide a basis for comparison for the
stpncpy_chk tests.  Hence, they remain manual.

TESTED:
Passes on all platforms, with all compatible SDKs.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen 56a9b9e919 test_traverse_cwd: Make parallelizable.
Makes created directory name unique.

Also make verbosity optional.

Also adds success/failure message.

TESTED:
Passes on all platforms, including running in parallel.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen e033a0b8e4 test_traverse: Make parallelizable.
Makes created directory name unique.

Also makes verbosity optional.

Also adds success/failure message.

TESTED:
Passes on all platforms, including running in parallel.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen 384b03e085 test_faccessat: Make parallelizable.
Makes created directory name unique.

Also adds success/failure message.

TESTED:
Passes on all platforms, including running in parallel.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen 7e67210a07 Put faccessat_setuid test where it belongs.
Since this is a manual test, it belongs in the manual_tests directory.

Also removes the Makefile message suggesting it, since this is only
one of many manual-only tests that may sometimes be appropriate.

Also moves the TMP dir to be under tst_data.

NOTE: Aside from the well-known issue where this test doesn't work on
10.4, it also doesn't work under Rosetta.  It's not yet known whether
this is a library issue or a test issue.

TESTED:
Works as expected on all platforms, except as noted above.
2025-07-11 17:34:31 -04:00
Fred WrightandChristopher Nielsen 3fbb1091c4 Makefile: Make test builds out-of-source.
As with the library builds, putting build targets in a separate
directory simplifies clean, simplifies .gitignore, and is more
completion-friendly.

Also renames some manual C++ tests to make the C++ more obvious (and
avoid collisions in the new tbin directory).

Also adds an "all" target for the manual packet tests.

Also fixes a bug in the st?ncpy_chk sources.

TESTED:
Works as intended on all platforms.
2025-07-11 17:34:31 -04:00