Skip to content

Conversation

@hamishknight
Copy link
Contributor

Update tests such that they run with both the old and new driver in preparation for switching over to the new driver.

This is only testing legacy driver behaviour. In
the new driver, only primary outputs have their
outputs deduced from the module name.
The new driver builds a PCH by default, which the
old driver didn't do. These tests don't expect a
PCH, so avoid building it.
Add `-wmo` to the invocation to ensure we don't
end up doing merge-modules, which makes the test
consistent across both the old and new driver.
A couple of tests are expecting merge-modules behaviour,
add `-no-emit-module-separately` in those cases to
ensure that merge modules is used in both the old
and new driver.
The new driver forms additional jobs for the
auxiliary outputs here, whereas the old driver
would only do a single job. This shouldn't really
matter in practice though since we make an effort
not to include auxiliary outputs in indexing
invocations.
CMO is enabled by default in the new driver, add
`-enable-default-cmo` in a couple of places to make
the behavior consistent across both the old and
new driver.
The behavior of these tests varies depending on
whether the new or old driver is being used, force
the old driver for now.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@QuietMisdreavus
Copy link
Contributor

SymbolGraphGen test update looks good.

How do you force running tests with the new driver? I'm interested to know so i can double-check during the transition period.

@hamishknight
Copy link
Contributor Author

@QuietMisdreavus You can force the new driver by setting SWIFT_FORCE_TEST_NEW_DRIVER=1 in your environment

// RUN: %target-build-swift -O -wmo -Xfrontend -enable-default-cmo -parse-as-library -emit-tbd -emit-tbd-path %t/ModuleTBD.tbd -emit-module -emit-module-path=%t/ModuleTBD.swiftmodule -module-name=ModuleTBD -package-name Pkg -I%t -I%S/Inputs/cross-module %S/Inputs/cross-module/default-module.swift -c -o %t/moduletbd.o -Xfrontend -tbd-install_name -Xfrontend module

// RUN: %target-build-swift -O -wmo -module-name=Main -package-name Pkg -I%t -I%S/Inputs/cross-module %s -emit-sil | %FileCheck %s
// RUN: %target-build-swift -Xfrontend -enable-default-cmo -O -wmo -module-name=Main -package-name Pkg -I%t -I%S/Inputs/cross-module %s -emit-sil | %FileCheck %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Default CMO should be enabled by default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test suite currently uses the old driver, where it's disabled by default

@hamishknight
Copy link
Contributor Author

@swift-ci please test Linux

@hamishknight hamishknight merged commit 8ba6a2c into swiftlang:main Sep 24, 2024
5 checks passed
@hamishknight hamishknight deleted the driver-parity branch September 24, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants