CI not testing Foundation overlay?

The Foundation overlay is a bit of a conundrum to work with at present:

The Xcode project cannot be compiled, at least if one adheres to the instructions, because it requires the use of the default toolchain (due to SR-12177) but also cannot be compiled with the default toolchain, since String.swift uses the @_spi feature to call String(_cocoaString:) and compiling with the default toolchain does not expose the required API.

At the same time, swift-ci doesn't seem to be running the Foundation overlay tests when testing PRs in swift-corelibs-foundation on the macOS platform. I noted this when a bug correctly caused the Linux tests to fail, but the macOS test was green despite the same issue being present in both the overlay and swift-corelibs-foundation. Digging through the log, I could see no evidence of any Foundation tests being run on macOS.

How are other folks testing the overlay, and am I incorrect that swift-ci doesn't seem to be actually doing any testing of Foundation on macOS despite initial appearances?

cc @mishal_shah

I thought the overlays were removed in apple/swift#37823, and became closed-source only?

The Foundation overlay is now in the swift-corelibs-foundation repo.

1 Like

Is there any progress in this?

:thought_balloon: By the way, build-script in swift repo seems not to build TestFoundation on macOS.


EDIT:

Jenkins runs "${WORKSPACE}/swift/utils/build-script" -R -T --llbuild --swiftpm --xctest --debug-foundation --reconfigure --install-libcxx --install-swift --install-llbuild --install-swiftpm --install-xctest --lit-args=-v in Swift Foundation Pull Request Test macOS.

However, ./swift/utils/build-script --debug-foundation builds SwiftFoundation on macOS, not the overlay. :thinking:


EDIT 2:

Referring to @lorentey's guidance in swift-corelibs-foundation/#2915, I did some trials.

env SWIFT_EXEC=./build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swiftc \
  SWIFT_LIBRARY_PATH=./build/Ninja-ReleaseAssert/swift-macosx-x86_64/lib/swift/macosx \
  xcodebuild -project ./swift-corelibs-foundation/Darwin/Foundation-swiftoverlay.xcodeproj

RESULT: xcodebuild used default toolchain and failed to compile String(_cocoaString: cocoaString) due to the same reason described by @xwu.

env SWIFT_EXEC=./build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swiftc \
  SWIFT_LIBRARY_PATH=./build/Ninja-ReleaseAssert/swift-macosx-x86_64/lib/swift/macosx \
  xcodebuild -project ./swift-corelibs-foundation/Darwin/Foundation-swiftoverlay.xcodeproj -toolchain org.swift.50202110051a

RESULT: error: no such module '_SwiftFoundationOverlayShims'

From Fix KVO for RawRepresentable types by ffried · Pull Request #3114 · apple/swift-corelibs-foundation · GitHub

The repository contains the overlay code but isn't set up to CI it. Appropriate people have been pinged.

:pleading_face: