Skip to content

swift test fails on FreeBSD #295

@kkebo

Description

@kkebo

Summary

swift test fails on FreeBSD.

  • FreeBSD 15.0-RELEASE-p1 x86_64
  • Swift version 6.3-dev (LLVM b58b2a34d509492, Swift cf535d8b998d09b) (Swift on FreeBSD Preview)
    • Target: x86_64-unknown-freebsd14.3
    • Build config: +assertions
  • swift-system main branch 7e474cb

Logs

After fixing #293:

$ swift test
...
Test Suite 'debug.xctest' passed at 2026-01-28 20:35:29.778
         Executed 52 tests, with 0 failures (0 unexpected) in 2.013 (2.013) seconds
Test Suite 'All tests' passed at 2026-01-28 20:35:29.778
         Executed 52 tests, with 0 failures (0 unexpected) in 2.013 (2.013) seconds
◇ Test run started.
↳ Testing Library Version: 6.3-dev (98430f2d6cb8d81)
↳ Target Platform: x86_64-unknown-freebsd
◇ Suite "Stat" started.
◇ Suite "FileMode" started.
◇ Test permissions() started.
◇ Test followSymlinkInits() started.
◇ Test flags() started.
◇ Test basics() started.
◇ Test times() started.
◇ Test basics() started.
◇ Test invalidInput() started.
✔ Test invalidInput() passed after 0.001 seconds.
✔ Test basics() passed after 0.001 seconds.
✔ Suite "FileMode" passed after 0.001 seconds.
✔ Test permissions() passed after 0.003 seconds.
✔ Test basics() passed after 0.003 seconds.
✘ Test flags() recorded an issue at StatTests.swift:387:11: Expectation failed: (fchflags(fd.rawValue, UInt(flags.rawValue)) → -1) == 0
↳ Operation not supported
✘ Test flags() failed after 0.004 seconds with 1 issue.
✘ Test followSymlinkInits() recorded an issue at StatTests.swift:121:7: Expectation failed: (symlinkStat.sizeAllocated → 512) < (targetStat.sizeAllocated → 512)
✘ Test followSymlinkInits() failed after 0.004 seconds with 1 issue.
✔ Test times() passed after 0.043 seconds.
✘ Suite "Stat" failed after 0.043 seconds with 2 issues.
✘ Test run with 7 tests in 2 suites failed after 0.044 seconds with 2 issues.
✘ Test flags() recorded an issue at StatTests.swift:387:11: Expectation failed: (fchflags(fd.rawValue, UInt(flags.rawValue)) → -1) == 0
↳ Operation not supported

This occurs since I use ZFS as a root file system. UF_IMMUTABLE, UF_APPEND, UF_OPAQUE, UF_NOUNLINK, and UF_REPARSE are not supported on ZFS. Although this may pass successfully on other file systems, ZFS is popular on FreeBSD. Thus, those flags should be omitted from the test case for FreeBSD.

https://github.com/openzfs/zfs/blob/a157ef62a16814459f925f14fe1b759bd4f8338d/module/os/freebsd/zfs/zfs_vnops_os.c#L5410-L5413

✘ Test followSymlinkInits() recorded an issue at StatTests.swift:121:7: Expectation failed: (symlinkStat.sizeAllocated → 512) < (targetStat.sizeAllocated → 512)

On FreeBSD, the value of st_blocks of a symlink is usually not zero. On the other hand, on linux, it is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions