Skip to content

tests: Refactor and expand end-to-end test coverage, disabled by default #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

euanh
Copy link
Contributor

@euanh euanh commented Nov 22, 2024

This commit extends the end-to-end tests to cover all currently-supported combinations of Swift version, Linux distribution and CPU architecture. For Ubuntu, there are also tests of SDKs built directly from packages and from container images.

These tests run slowly (about 30 minutes on my machine), so they are disabled unless the SWIFT_SDK_GENERATOR_RUN_SLOW_TESTS environment variable is set.

There is further scope for speeding up the generation of SDKs from container images, which might allow more tests to be included by default. Quite a lot of time, on macOS, is also spent waiting for the toolchain embedded in the SDK to be verified - this is more difficult to mitigate.

Splitting the tests up makes it easier to see problems which affect particular configurations. Each integration test case tries to build two different programs; ideally these would be reported as separate test cases, but for now some manual re-testing is needed to separate the causes of test failures.

Currently there are two pre-existing problems on main which cause tests to fail:

In some cases issue #152 masks issue #147, because it occurs earlier in the build process. For instance, using ubuntu_aarch64_6.0.2-RELEASE_with-docker to build the 'Foundation' test case currently fails because of #152, but if that were to be fixed it would then still fail because of #147.

SDK Hello World Foundation
ubuntu_aarch64_5.9.2-RELEASE ok ok
ubuntu_aarch64_5.9.2-RELEASE_with-docker FAIL1 FAIL1
ubuntu_aarch64_5.10.1-RELEASE ok ok
ubuntu_aarch64_5.10.1-RELEASE_with-docker FAIL1 FAIL1
ubuntu_aarch64_6.0.2-RELEASE ok FAIL2
ubuntu_aarch64_6.0.2-RELEASE_with-docker FAIL1 FAIL2
ubuntu_x86_64_5.9.2-RELEASE ok ok
ubuntu_x86_64_5.9.2-RELEASE_with-docker ok ok
ubuntu_x86_64_5.10.1-RELEASE ok ok
ubuntu_x86_64_5.10.1-RELEASE_with-docker ok ok
ubuntu_x86_64_6.0.2-RELEASE ok FAIL2
ubuntu_x86_64_6.0.2-RELEASE_with-docker ok FAIL2
rhel_aarch64_5.9.2-RELEASE_with-docker FAIL1 FAIL1
rhel_aarch64_5.10.1-RELEASE_with-docker FAIL1 FAIL1
rhel_aarch64_6.0.2-RELEASE_with-docker FAIL1 FAIL2
rhel_x86_64_5.9.2-RELEASE_with-docker ok ok
rhel_x86_64_5.10.1-RELEASE_with-docker ok ok
rhel_x86_64_6.0.2-RELEASE_with-docker ok FAIL2

FAIL1: cannot find /lib/ld-linux-aarch64.so.1 (Issue #147)
FAIL2: missing required module '_FoundationCShims' (Issue #152)

@euanh euanh added the test suite Changes to generator's test suite label Nov 22, 2024
@euanh
Copy link
Contributor Author

euanh commented Nov 22, 2024

@swift-ci test

euanh added a commit to euanh/swift-sdk-generator that referenced this pull request Nov 22, 2024
…tions

Issue swiftlang#147 occurs because the ELF interpreter is found at different
paths, and with different names, on different architectures.    We
happen to pick up the x86_64 interpreter because it is stored in /lib64,
which we aready copy, but we miss the aarch64 interpreter.

An ELF binary contains an interpreter path which can point anywhere, but
there are defacto standard default locations.

* According to https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf)
  the x86_64 / amd64 ABI specifies that the interpreter should be
  at /lib/ld64.so.1, but Linux overrides this and uses
  /lib64/ld-linux-x86-64.so.2.

* I couldn't find a similar document for ARM64 / aarch64 -
  https://github.com/ARM-software/abi-aa/tree/main/aaelf64 is silent
  on the interpreter path - but most sources I could find place it
  at /lib/ld-linux-aarch64.so.1 - for example
  zulu-openjdk/zulu-openjdk#11

There is a pattern to the paths and filenames but it seems risky to
try to construct them;  instead this PR adds a new field to `Triple`
which returns the default path for each architecture.   For now we
only support x86_64 and aarch64 - if new architectures are added in
future we will need to add new entries for them.

This change fixes issue swiftlang#147.   Compared to swiftlang#153, all the basic
'hello world' tests now pass.   The tests which import Foundation
still fail on all Swift 6.0 SDKs.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | FAIL2      |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | FAIL2      |
|                                           |             |            |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | FAIL2      |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | FAIL2      |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | FAIL2      |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | FAIL2      |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1
FAIL2: missing required module '_FoundationCShims'

Fixes: swiftlang#147
@euanh euanh marked this pull request as ready for review November 22, 2024 18:07
@euanh euanh requested a review from MaxDesiatov as a code owner November 22, 2024 18:07
This commit extends the end-to-end tests to cover all currently-supported
combinations of Swift version, Linux distribution and CPU architecture.
For Ubuntu, there are also tests of SDKs built directly from packages
and from container images.

These tests run slowly (about 30 minutes on my machine), so they
are disabled unless the SWIFT_SDK_GENERATOR_RUN_SLOW_TESTS environment
variable is set.

There is further scope for speeding up the generation of SDKs from
container images, which might allow more tests to be included by default.
Quite a lot of time, on macOS, is also spent waiting for the toolchain
embedded in the SDK to be verified - this is more difficult to mitigate.

Splitting the tests up makes it easier to see problems which affect
particular configurations.   Each integration test case tries to build
two different programs;  ideally these would be reported as separate
test cases, but for now some manual re-testing is needed to separate
the causes of test failures.

Currently there are two problems on main which cause tests to fail:
 * Issue swiftlang#147 causes ld-linux-aarch64.so.1 not to be copied into
   SDKs built from containers.  Attempted builds using these SDKs
   fails at the final link stage.
 * Issue swiftlang#152 causes new shims not to be copied into all Swift 6.0
   SDKs.   Attempted builds with these SDKs fail during compilation
   stage, if Foundation is used.

In some cases issue swiftlang#152 masks issue swiftlang#147, because it occurs earlier
in the build process.   For instance, using ubuntu_aarch64_6.0.2-RELEASE_with-docker
to build the 'Foundation' test case currently fails because of swiftlang#152,
but if that were to be fixed it would then still fail because of swiftlang#147.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | FAIL1       | FAIL1      |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | FAIL1       | FAIL1      |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | FAIL2      |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | FAIL1       | FAIL2      |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | FAIL2      |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | FAIL2      |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | FAIL1       | FAIL1      |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | FAIL1       | FAIL1      |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | FAIL1       | FAIL2      |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | FAIL2      |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1       (Issue swiftlang#147)
FAIL2: missing required module '_FoundationCShims'  (Issue swiftlang#152)
@euanh euanh force-pushed the extend-end-to-end-tests branch from 4725774 to b7cf646 Compare November 25, 2024 10:29
@euanh
Copy link
Contributor Author

euanh commented Nov 25, 2024

@swift-ci test

@euanh euanh enabled auto-merge (squash) November 25, 2024 10:32
euanh added a commit to euanh/swift-sdk-generator that referenced this pull request Nov 25, 2024
…tions

Issue swiftlang#147 occurs because the ELF interpreter is found at different
paths, and with different names, on different architectures.    We
happen to pick up the x86_64 interpreter because it is stored in /lib64,
which we aready copy, but we miss the aarch64 interpreter.

An ELF binary contains an interpreter path which can point anywhere, but
there are defacto standard default locations.

* According to https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf)
  the x86_64 / amd64 ABI specifies that the interpreter should be
  at /lib/ld64.so.1, but Linux overrides this and uses
  /lib64/ld-linux-x86-64.so.2.

* I couldn't find a similar document for ARM64 / aarch64 -
  https://github.com/ARM-software/abi-aa/tree/main/aaelf64 is silent
  on the interpreter path - but most sources I could find place it
  at /lib/ld-linux-aarch64.so.1 - for example
  zulu-openjdk/zulu-openjdk#11

There is a pattern to the paths and filenames but it seems risky to
try to construct them;  instead this PR adds a new field to `Triple`
which returns the default path for each architecture.   For now we
only support x86_64 and aarch64 - if new architectures are added in
future we will need to add new entries for them.

This change fixes issue swiftlang#147.   Compared to swiftlang#153, all the basic
'hello world' tests now pass.   The tests which import Foundation
still fail on all Swift 6.0 SDKs.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | FAIL2      |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | FAIL2      |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | FAIL2      |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | FAIL2      |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | FAIL2      |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | FAIL2      |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1
FAIL2: missing required module '_FoundationCShims'

Fixes: swiftlang#147
euanh added a commit to euanh/swift-sdk-generator that referenced this pull request Nov 25, 2024
…tions

Issue swiftlang#147 occurs because the ELF interpreter is found at different
paths, and with different names, on different architectures.    We
happen to pick up the x86_64 interpreter because it is stored in /lib64,
which we aready copy, but we miss the aarch64 interpreter.

An ELF binary contains an interpreter path which can point anywhere, but
there are defacto standard default locations.

* According to https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf)
  the x86_64 / amd64 ABI specifies that the interpreter should be
  at /lib/ld64.so.1, but Linux overrides this and uses
  /lib64/ld-linux-x86-64.so.2.

* I couldn't find a similar document for ARM64 / aarch64 -
  https://github.com/ARM-software/abi-aa/tree/main/aaelf64 is silent
  on the interpreter path - but most sources I could find place it
  at /lib/ld-linux-aarch64.so.1 - for example
  zulu-openjdk/zulu-openjdk#11

There is a pattern to the paths and filenames but it seems risky to
try to construct them;  instead this PR adds a new field to `Triple`
which returns the default path for each architecture.   For now we
only support x86_64 and aarch64 - if new architectures are added in
future we will need to add new entries for them.

This change fixes issue swiftlang#147.   Compared to swiftlang#153, all the basic
'hello world' tests now pass.   The tests which import Foundation
still fail on all Swift 6.0 SDKs.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | FAIL2      |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | FAIL2      |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | FAIL2      |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | FAIL2      |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | FAIL2      |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | FAIL2      |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1
FAIL2: missing required module '_FoundationCShims'

Fixes: swiftlang#147
euanh added a commit to euanh/swift-sdk-generator that referenced this pull request Nov 26, 2024
Building with a Swift 6.0 SDK fails because the new `_FoundationCShims`
framework headers can't be found:

    <unknown>:0: error: missing required module '_FoundationCShims'

The necessary files are present in `$PLATFORM.sdk/usr/lib/swift`,
but are not part of the list which is copied to
`$PLATFORM.sdk/usr/include`.  The Static Linux SDK and WASM SDK
generator don't copy these files into /usr/include;  instead they
set the `swiftResourcesPath` and `swiftStaticResourcesPath` fields
in `swift-sdk.json`, which causes the build system to look in those
paths for framework headers.

We can do the same for Linux SDKs, however we must stop copying the
files to `/usr/include`, otherwise the build will fail because the
framework header definitions are duplicated:

    error: redefinition of module 'DispatchIntrospection'
     6 | }
     7 |
     8 | module DispatchIntrospection [system] [extern_c] {
       |        `- error: redefinition of module 'DispatchIntrospection'
     9 |    header "introspection.h"
    10 |    export *

This change fixes issue swiftlang#152. Compared to swiftlang#153, the end-to-end
tests now pass for all supported Swift versions, distributions and
architectures.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | ok         |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | ok         |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | ok         |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | ok         |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1  (swiftlang#147)
FAIL2: missing required module '_FoundationCShims'   (swiftlang#152)

Fixes: swiftlang#152
Depends on: swiftlang#153, swiftlang#154
euanh added a commit to euanh/swift-sdk-generator that referenced this pull request Nov 27, 2024
…tions

Issue swiftlang#147 occurs because the ELF interpreter is found at different
paths, and with different names, on different architectures.    We
happen to pick up the x86_64 interpreter because it is stored in /lib64,
which we aready copy, but we miss the aarch64 interpreter.

An ELF binary contains an interpreter path which can point anywhere, but
there are defacto standard default locations.

* According to https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf)
  the x86_64 / amd64 ABI specifies that the interpreter should be
  at /lib/ld64.so.1, but Linux overrides this and uses
  /lib64/ld-linux-x86-64.so.2.

* I couldn't find a similar document for ARM64 / aarch64 -
  https://github.com/ARM-software/abi-aa/tree/main/aaelf64 is silent
  on the interpreter path - but most sources I could find place it
  at /lib/ld-linux-aarch64.so.1 - for example
  zulu-openjdk/zulu-openjdk#11

There is a pattern to the paths and filenames but it seems risky to
try to construct them;  instead this PR adds a new field to `Triple`
which returns the default path for each architecture.   For now we
only support x86_64 and aarch64 - if new architectures are added in
future we will need to add new entries for them.

This change fixes issue swiftlang#147.   Compared to swiftlang#153, all the basic
'hello world' tests now pass.   The tests which import Foundation
still fail on all Swift 6.0 SDKs.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | FAIL2      |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | FAIL2      |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | FAIL2      |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | FAIL2      |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | FAIL2      |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | FAIL2      |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1
FAIL2: missing required module '_FoundationCShims'

Fixes: swiftlang#147
euanh added a commit to euanh/swift-sdk-generator that referenced this pull request Nov 27, 2024
Building with a Swift 6.0 SDK fails because the new `_FoundationCShims`
framework headers can't be found:

    <unknown>:0: error: missing required module '_FoundationCShims'

The necessary files are present in `$PLATFORM.sdk/usr/lib/swift`,
but are not part of the list which is copied to
`$PLATFORM.sdk/usr/include`.  The Static Linux SDK and WASM SDK
generator don't copy these files into /usr/include;  instead they
set the `swiftResourcesPath` and `swiftStaticResourcesPath` fields
in `swift-sdk.json`, which causes the build system to look in those
paths for framework headers.

We can do the same for Linux SDKs, however we must stop copying the
files to `/usr/include`, otherwise the build will fail because the
framework header definitions are duplicated:

    error: redefinition of module 'DispatchIntrospection'
     6 | }
     7 |
     8 | module DispatchIntrospection [system] [extern_c] {
       |        `- error: redefinition of module 'DispatchIntrospection'
     9 |    header "introspection.h"
    10 |    export *

This change fixes issue swiftlang#152. Compared to swiftlang#153, the end-to-end
tests now pass for all supported Swift versions, distributions and
architectures.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | ok         |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | ok         |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | ok         |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | ok         |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1  (swiftlang#147)
FAIL2: missing required module '_FoundationCShims'   (swiftlang#152)

Fixes: swiftlang#152
Depends on: swiftlang#153, swiftlang#154
@euanh euanh disabled auto-merge November 27, 2024 15:33
@euanh euanh merged commit 512bcaa into swiftlang:main Nov 27, 2024
3 checks passed
@euanh euanh deleted the extend-end-to-end-tests branch November 27, 2024 15:34
euanh added a commit to euanh/swift-sdk-generator that referenced this pull request Nov 27, 2024
…tions

Issue swiftlang#147 occurs because the ELF interpreter is found at different
paths, and with different names, on different architectures.    We
happen to pick up the x86_64 interpreter because it is stored in /lib64,
which we aready copy, but we miss the aarch64 interpreter.

An ELF binary contains an interpreter path which can point anywhere, but
there are defacto standard default locations.

* According to https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf)
  the x86_64 / amd64 ABI specifies that the interpreter should be
  at /lib/ld64.so.1, but Linux overrides this and uses
  /lib64/ld-linux-x86-64.so.2.

* I couldn't find a similar document for ARM64 / aarch64 -
  https://github.com/ARM-software/abi-aa/tree/main/aaelf64 is silent
  on the interpreter path - but most sources I could find place it
  at /lib/ld-linux-aarch64.so.1 - for example
  zulu-openjdk/zulu-openjdk#11

There is a pattern to the paths and filenames but it seems risky to
try to construct them;  instead this PR adds a new field to `Triple`
which returns the default path for each architecture.   For now we
only support x86_64 and aarch64 - if new architectures are added in
future we will need to add new entries for them.

This change fixes issue swiftlang#147.   Compared to swiftlang#153, all the basic
'hello world' tests now pass.   The tests which import Foundation
still fail on all Swift 6.0 SDKs.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | FAIL2      |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | FAIL2      |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | FAIL2      |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | FAIL2      |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | FAIL2      |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | FAIL2      |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1
FAIL2: missing required module '_FoundationCShims'

Fixes: swiftlang#147
euanh added a commit that referenced this pull request Nov 27, 2024
…tions (#154)

Issue #147 occurs because the ELF interpreter is found at different
paths, and with different names, on different architectures.    We
happen to pick up the x86_64 interpreter because it is stored in /lib64,
which we aready copy, but we miss the aarch64 interpreter.

An ELF binary contains an interpreter path which can point anywhere, but
there are defacto standard default locations.

* According to https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf)
  the x86_64 / amd64 ABI specifies that the interpreter should be
  at /lib/ld64.so.1, but Linux overrides this and uses
  /lib64/ld-linux-x86-64.so.2.

* I couldn't find a similar document for ARM64 / aarch64 -
  https://github.com/ARM-software/abi-aa/tree/main/aaelf64 is silent
  on the interpreter path - but most sources I could find place it
  at /lib/ld-linux-aarch64.so.1 - for example
  zulu-openjdk/zulu-openjdk#11

There is a pattern to the paths and filenames but it seems risky to
try to construct them;  instead this PR adds a new field to `Triple`
which returns the default path for each architecture.   For now we
only support x86_64 and aarch64 - if new architectures are added in
future we will need to add new entries for them.

This change fixes issue #147.   Compared to #153, all the basic
'hello world' tests now pass.   The tests which import Foundation
still fail on all Swift 6.0 SDKs.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | FAIL2      |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | FAIL2      |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | FAIL2      |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | FAIL2      |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | FAIL2      |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | FAIL2      |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1
FAIL2: missing required module '_FoundationCShims'

Fixes: #147
euanh added a commit to euanh/swift-sdk-generator that referenced this pull request Nov 27, 2024
Building with a Swift 6.0 SDK fails because the new `_FoundationCShims`
framework headers can't be found:

    <unknown>:0: error: missing required module '_FoundationCShims'

The necessary files are present in `$PLATFORM.sdk/usr/lib/swift`,
but are not part of the list which is copied to
`$PLATFORM.sdk/usr/include`.  The Static Linux SDK and WASM SDK
generator don't copy these files into /usr/include;  instead they
set the `swiftResourcesPath` and `swiftStaticResourcesPath` fields
in `swift-sdk.json`, which causes the build system to look in those
paths for framework headers.

We can do the same for Linux SDKs, however we must stop copying the
files to `/usr/include`, otherwise the build will fail because the
framework header definitions are duplicated:

    error: redefinition of module 'DispatchIntrospection'
     6 | }
     7 |
     8 | module DispatchIntrospection [system] [extern_c] {
       |        `- error: redefinition of module 'DispatchIntrospection'
     9 |    header "introspection.h"
    10 |    export *

This change fixes issue swiftlang#152. Compared to swiftlang#153, the end-to-end
tests now pass for all supported Swift versions, distributions and
architectures.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | ok         |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | ok         |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | ok         |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | ok         |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1  (swiftlang#147)
FAIL2: missing required module '_FoundationCShims'   (swiftlang#152)

Fixes: swiftlang#152
Depends on: swiftlang#153, swiftlang#154
euanh added a commit to euanh/swift-sdk-generator that referenced this pull request Nov 28, 2024
Building with a Swift 6.0 SDK fails because the new `_FoundationCShims`
framework headers can't be found:

    <unknown>:0: error: missing required module '_FoundationCShims'

The necessary files are present in `$PLATFORM.sdk/usr/lib/swift`,
but are not part of the list which is copied to
`$PLATFORM.sdk/usr/include`.  The Static Linux SDK and WASM SDK
generator don't copy these files into /usr/include;  instead they
set the `swiftResourcesPath` and `swiftStaticResourcesPath` fields
in `swift-sdk.json`, which causes the build system to look in those
paths for framework headers.

We can do the same for Linux SDKs, however we must stop copying the
files to `/usr/include`, otherwise the build will fail because the
framework header definitions are duplicated:

    error: redefinition of module 'DispatchIntrospection'
     6 | }
     7 |
     8 | module DispatchIntrospection [system] [extern_c] {
       |        `- error: redefinition of module 'DispatchIntrospection'
     9 |    header "introspection.h"
    10 |    export *

This change fixes issue swiftlang#152. Compared to swiftlang#153, the end-to-end
tests now pass for all supported Swift versions, distributions and
architectures.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | ok         |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | ok         |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | ok         |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | ok         |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1  (swiftlang#147)
FAIL2: missing required module '_FoundationCShims'   (swiftlang#152)

Fixes: swiftlang#152
Depends on: swiftlang#153, swiftlang#154
euanh added a commit that referenced this pull request Nov 28, 2024
Building with a Swift 6.0 SDK fails because the new `_FoundationCShims`
framework headers can't be found:

    <unknown>:0: error: missing required module '_FoundationCShims'

The necessary files are present in `$PLATFORM.sdk/usr/lib/swift`,
but are not part of the list which is copied to
`$PLATFORM.sdk/usr/include`.  The Static Linux SDK and WASM SDK
generator don't copy these files into /usr/include;  instead they
set the `swiftResourcesPath` and `swiftStaticResourcesPath` fields
in `swift-sdk.json`, which causes the build system to look in those
paths for framework headers.

We can do the same for Linux SDKs, however we must stop copying the
files to `/usr/include`, otherwise the build will fail because the
framework header definitions are duplicated:

    error: redefinition of module 'DispatchIntrospection'
     6 | }
     7 |
     8 | module DispatchIntrospection [system] [extern_c] {
       |        `- error: redefinition of module 'DispatchIntrospection'
     9 |    header "introspection.h"
    10 |    export *

This change fixes issue #152. Compared to #153, the end-to-end
tests now pass for all supported Swift versions, distributions and
architectures.

| SDK                                       | Hello World | Foundation |
| ----------------------------------------- | ----------- | ---------- |
| ubuntu_aarch64_5.9.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_5.9.2-RELEASE_with-docker  | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE             | ok          | ok         |
| ubuntu_aarch64_5.10.1-RELEASE_with-docker | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE              | ok          | ok         |
| ubuntu_aarch64_6.0.2-RELEASE_with-docker  | ok          | ok         |
|                                           |             |            |
| ubuntu_x86_64_5.9.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_5.9.2-RELEASE_with-docker   | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE              | ok          | ok         |
| ubuntu_x86_64_5.10.1-RELEASE_with-docker  | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE               | ok          | ok         |
| ubuntu_x86_64_6.0.2-RELEASE_with-docker   | ok          | ok         |
|                                           |             |            |
| rhel_aarch64_5.9.2-RELEASE_with-docker    | ok          | ok         |
| rhel_aarch64_5.10.1-RELEASE_with-docker   | ok          | ok         |
| rhel_aarch64_6.0.2-RELEASE_with-docker    | ok          | ok         |
|                                           |             |            |
| rhel_x86_64_5.9.2-RELEASE_with-docker     | ok          | ok         |
| rhel_x86_64_5.10.1-RELEASE_with-docker    | ok          | ok         |
| rhel_x86_64_6.0.2-RELEASE_with-docker     | ok          | ok         |

FAIL1: cannot find /lib/ld-linux-aarch64.so.1  (#147)
FAIL2: missing required module '_FoundationCShims'   (#152)

Fixes: #152
Depends on: #153, #154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test suite Changes to generator's test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants