Failed tests when compiling for Amazon Linux 2023

I'm working on the Amazon Linux 2023 swift build.

The details are in this message.

TL;DR, I managed to compile Swift 5.8 and Swift 5.9 on Amazon Linux 2023 x64 and Arm (Amazon Graviton). I have a standalone script for EC2, a PR in progress to produce the RPM, and a build environment for the Swift CI system.

The compilation of the Swift project release/5.8 branch works both on x64 and aarch64 , but I have 4 tests that fail.

********************
Failed Tests (4):
  Swift(linux-x86_64) :: Index/Store/output-failure.swift
  Swift(linux-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift
  Swift(linux-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift
  Swift(linux-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode.swift

The output-failure generates something like

--
Exit Code: 2

Command Output (stderr):
--
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/build-user/build/buildbot_linux/llvm-linux-x86_64/bin/FileCheck --allow-unused-prefixes /home/build-user/swift/test/Index/Store/output-failure.swift -check-prefix=DIR_ERR

--

And the three module-loading-xxx generate these :

Command Output (stderr):
--
/home/build-user/swift/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift:96:20: error: NO-SUCH-MODULE: expected string not found in input
// NO-SUCH-MODULE: [[@LINE-1]]:8: error: no such module 'Lib'
                   ^
<stdin>:1:1: note: scanning from here
SOURCE_DIR/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift:101:16: error: cannot convert value of type 'FromInterface' to specified type 'X'
^
<stdin>:1:1: note: with "@LINE-1" equal to "95"
SOURCE_DIR/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift:101:16: error: cannot convert value of type 'FromInterface' to specified type 'X'
^
<stdin>:1:89: note: possible intended match here
SOURCE_DIR/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift:101:16: error: cannot convert value of type 'FromInterface' to specified type 'X'
                                                                                        ^

Input file: <stdin>
Check file: /home/build-user/swift/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: SOURCE_DIR/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift:101:16: error: cannot convert value of type 'FromInterface' to specified type 'X' 
check:96'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:96'1                                                                                                                                                                              with "@LINE-1" equal to "95"
check:96'2                                                                                             ?                                                                                possible intended match
            2: let _: X = Lib.testValue 
check:96'0     ~~~~~~~~~~~~~~~~~~~~~~~~~
            3:  ~~~~^~~~~~~~~ 
check:96'0     ~~~~~~~~~~~~~~~
>>>>>>

--

Any idea how to get around these ?

1 Like

Do all tests pass for release/5.9? The release/5.8 branch was abandoned late last year, so I don't think it is worth fixing.

My advice would be to just get 5.9 or 5.10 working, as the Spring release usually happens in March, and install the official AL2 build of 5.8 or 5.9 in Docker to build 5.9 or 5.10 in AL2023, as my understanding is those AL2 compilers mostly work fine as bootstrap compilers (you may need to --skip-early-swift-driver on AL2023 when building with the AL2 compiler, which is irrelevant to the build anyway).

Once you have an official release for AL2023, you can start using that to bootstrap from then on.

I added Swift 5.8 toolchain built for Amazon Linux 2 to the swift-ci container image I use to build the 5.9 toolchain on Amazon Linux 2023 and it works (as @taylorswift already reported)

But I confirm I observe the same 4 tests failures

Failed Tests (4):
  Swift(linux-x86_64) :: Index/Store/output-failure.swift
  Swift(linux-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift
  Swift(linux-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift
  Swift(linux-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode.swift


Testing Time: 588.74s
  Unsupported      :  2128
  Passed           : 14742
  Expectedly Failed:    39
  Failed           :     4
2 Likes

That's a strange one, as it should be passing in a text file to FileCheck instead. If you can run commands in the Docker image after the test suite run, you can execute the generated test script yourself manually and tinker with it till you figure out the problem:

cd /home/build-user/build/buildbot_linux/swift-linux-x86_64/test-android-aarch64/Index/Store/Output/
source output-failure.swift.script

No idea, what I'll do is go to the failing line in the test script, comment out the trailing FileCheck on that line, and run the script to dump the compiler output. That will tell you what is going wrong.

Unless Mishal tells you he wants to put out a 5.9.3 AL2023 toolchain, I'd just build 5.10 and only fix these if you're hitting them there too.