Skip to content

[llvm-ar] Fix darwin-related tests' XFAIL annotation #130144

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
Mar 7, 2025

Conversation

pratlucas
Copy link
Contributor

The tests updated by this commit are expected to fail when targetting a
darwin platform. As they rely on target detection based on the host,
this is currently checked by using the XFAIL: system-darwin
annotation.

This approach becomes a problem when trying to run such tests on a
cross-compiling build of clang on a darwin platform. When no darwin
targets are included in the build, the XFAIL will still apply even
though the target used is not related to the darwin platform, and the
tests will unexpectedly pass.

To fix this issue, this patch updates the condition used by the tests'
XFAIL annotation to target={{.*}}-darwin{{.*}}, ensuring they only are
xfailed when the relevant target is used.

The tests updated by this commit are expected to fail when targetting a
darwin platform. As they rely on target detection based on the host,
this is currently checked by using the `XFAIL: system-darwin`
annotation.

This approach becomes a problem when trying to run such tests on a
cross-compiling build of clang on a darwin platform. When no darwin
targets are included in the build, the XFAIL will still apply even
though the target used is not related to the darwin platform, and the
tests will unexpectedly pass.

To fix this issue, this patch updates the condition used by the tests'
XFAIL annotation to `target={{.*}}-darwin{{.*}}`, ensuring they only are
xfailed when the relevant target is used.
@llvmbot
Copy link
Member

llvmbot commented Mar 6, 2025

@llvm/pr-subscribers-llvm-binary-utilities

Author: Lucas Duarte Prates (pratlucas)

Changes

The tests updated by this commit are expected to fail when targetting a
darwin platform. As they rely on target detection based on the host,
this is currently checked by using the XFAIL: system-darwin
annotation.

This approach becomes a problem when trying to run such tests on a
cross-compiling build of clang on a darwin platform. When no darwin
targets are included in the build, the XFAIL will still apply even
though the target used is not related to the darwin platform, and the
tests will unexpectedly pass.

To fix this issue, this patch updates the condition used by the tests'
XFAIL annotation to target={{.*}}-darwin{{.*}}, ensuring they only are
xfailed when the relevant target is used.


Full diff: https://github.com/llvm/llvm-project/pull/130144.diff

2 Files Affected:

  • (modified) llvm/test/tools/llvm-ar/extract.test (+1-1)
  • (modified) llvm/test/tools/llvm-ar/print.test (+1-1)
diff --git a/llvm/test/tools/llvm-ar/extract.test b/llvm/test/tools/llvm-ar/extract.test
index ccad703f3a149..bf46cc0743c7d 100644
--- a/llvm/test/tools/llvm-ar/extract.test
+++ b/llvm/test/tools/llvm-ar/extract.test
@@ -1,5 +1,5 @@
 ## Test extract operation.
-# XFAIL: system-darwin
+# XFAIL: target={{.*}}-darwin{{.*}}
 
 # RUN: rm -rf %t && mkdir -p %t/extracted/
 
diff --git a/llvm/test/tools/llvm-ar/print.test b/llvm/test/tools/llvm-ar/print.test
index a27cab4a227e1..997c05f225a8b 100644
--- a/llvm/test/tools/llvm-ar/print.test
+++ b/llvm/test/tools/llvm-ar/print.test
@@ -1,5 +1,5 @@
 ## Test Print output
-# XFAIL: system-darwin
+# XFAIL: target={{.*}}-darwin{{.*}}
 
 # RUN: rm -rf %t && mkdir -p %t
 # RUN: echo file1 > %t/1.txt

Copy link
Collaborator

@jh7370 jh7370 left a comment

Choose a reason for hiding this comment

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

I don't have a Mac to test this on. It seems simple enough and I'm fairly confident it is correct. I assume you have verified that this does indeed XFAIL the tests under the condition you expect it to?

One request: please change the tag in the title to [llvm-ar], since this change has nothing to do with clang. LGTM with that.

@pratlucas pratlucas changed the title [clang] Fix darwin-related tests' XFAIL annotation [llvm-ar] Fix darwin-related tests' XFAIL annotation Mar 7, 2025
@pratlucas
Copy link
Contributor Author

Thanks for the review! I did verify it on a Mac, both with a regular LLVM build and a cross-compiling downstream project (arm/arm-toolchain).

I've updated the PR title, which will be final commit message. Sorry about mixing it up, that's what I get for copy-pasting the commit message from #130138 :)

@pratlucas pratlucas merged commit dc69eae into llvm:main Mar 7, 2025
13 checks passed
@pratlucas pratlucas deleted the darwin-xfail branch March 7, 2025 10:53
pratlucas added a commit to pratlucas/arm-toolchain that referenced this pull request Mar 19, 2025
This cherry-picks the upstream change from llvm/llvm-project#130144,
which landed on the `main` branch, into our 20.x release. The change is
included as a patch file for llvm.
pratlucas added a commit to arm/arm-toolchain that referenced this pull request Mar 20, 2025
This cherry-picks the upstream change from llvm/llvm-project#130144,
which landed on the `main` branch, into our 20.x release. The change is
included as a patch file for llvm.
jph-13 pushed a commit to jph-13/llvm-project that referenced this pull request Mar 21, 2025
The tests updated by this commit are expected to fail when targetting a
darwin platform. As they rely on target detection based on the host,
this is currently checked by using the `XFAIL: system-darwin`
annotation.

This approach becomes a problem when trying to run such tests on a
cross-compiling build of clang on a darwin platform. When no darwin
targets are included in the build, the XFAIL will still apply even
though the target used is not related to the darwin platform, and the
tests will unexpectedly pass.

To fix this issue, this patch updates the condition used by the tests'
XFAIL annotation to `target={{.*}}-darwin{{.*}}`, ensuring they only are
xfailed when the relevant target is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants