Skip to content

tests: fix some tests for enabling OSSA modules #78943

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 3 commits into from
Jan 27, 2025

Conversation

eeckstein
Copy link
Contributor

  • Temporarily disable ClangImporter/enum-error-execute.swift. It fails with enabled OSSA modules and when run in optimize mode: rdar://143681997

  • Fix lifetimes of objects in two tests. Those tests rely on lexical object lifetimes. But lifetimes are only guaranteed for "variables" but not for temporary objects. Storing those objects in variables fixes the issue.

  • Make tests more resilient to optimizations by passing values to _blackHole. Without _blackHole, the optimizer may remove or make assumptions about values, which are not intended by the test.

This is part of rdar://140229560.

It fails with enabled OSSA modules and when run in optimize mode.
The problem is that TestErrorDomain (a NSString pointer) is null, but it's not imported as Optional<NSString>.

rdar://143681997
Those tests rely on lexical object lifetimes. But lifetimes are only guaranteed for "variables" but not for temporary objects.
Storing those objects in variables fixes the issue.

This fixes the tests when running them in optimize mode and when OSSA modules are enabled.

This is part of rdar://140229560.
…o `_blackHole`

Without `_blackHole`, the optimizer may remove or make assumptions about values, which are not intended by the test.
This fixes the tests when running them in optimize mode and when OSSA modules are enabled.

This is part of rdar://140229560.
@eeckstein eeckstein requested a review from a team as a code owner January 27, 2025 09:41
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test

@eeckstein
Copy link
Contributor Author

@swift-ci smoke test windows

@eeckstein eeckstein merged commit ca751cb into swiftlang:main Jan 27, 2025
3 checks passed
@eeckstein eeckstein deleted the fix-tests-for-ossa branch January 27, 2025 20:35
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.

2 participants