Targeting test-cases to run on a particular architecture - linker-args-order-linux.swift

I am running into issues running few testcases on s390x architecture. Failure seems to happen because it tries to find x86 target instead of s390x. For example, following test-case is fixed on s390x by applying this patch:

diff --git a/test/Driver/linker-args-order-linux.swift b/test/Driver/linker-args-order-linux.swift
index 5999bfe..fc2a571 100644
--- a/test/Driver/linker-args-order-linux.swift
+++ b/test/Driver/linker-args-order-linux.swift
@@ -4,6 +4,6 @@
 print("hello world!")
 // RUN: %empty-directory(%t)
 // RUN: %target-swiftc_driver -driver-print-jobs -static-stdlib -o %t/static-stdlib %s -Xlinker --no-allow-multiple-definition 2>&1| %FileCheck %s
-// CHECK: {{.*}}/swift -frontend -c -primary-file {{.*}}/linker-args-order-linux.swift -target **x86_64-unknown-linux-gnu** -disable-objc-interop
+// CHECK: {{.*}}/swift -frontend -c -primary-file {{.*}}/linker-args-order-linux.swift -target **s390x-unknown-linux-gnu** -disable-objc-interop
 // CHECK: {{.*}}/swift-autolink-extract{{.*}}
 // CHECK: {{.*}}swiftrt.o /{{.*}}/linker-args-order-linux-{{[a-z0-9]+}}.o @/{{.*}}/linker-args-order-linux-{{[a-z0-9]+}}.autolink {{.*}} @{{.*}}/static-stdlib-args.lnk {{.*}} -Xlinker --no-allow-multiple-definition

This change will obviously cause regression on x86 platforms. I was wondering if there is a way of parameterizing -target option so that correct OS is picked up when test-cases are executed.

Thanks.

linker-args-order-linux.swift on master doesn't include a target anymore as of PR #17749, for exactly this reason. :-) You can cherry-pick that change to the branch being tested.

Great - will do . Thanks @jrose

I think problem also applies to test/IRGen/ELF-objc-sections.swift

Aha, sure. That one should probably be using %target-swift-frontend, since it already has a REQUIRES: OS=linux-gnu to ensure that it's only run on Linux systems. (And it does need that, because it needs the output format to be ELF.)

Sure will give that a shot.

test/Driver/sanitizers.swift has INCOMPATIBLESANITIZERS tag which used to work in 4.1 on s390x because of the way SanitizerOptions.cpp built the sanitizerSet. In 4.2 sanitizerSet only contains supported sanitizers. Since this testcase does not apply at the moment on s390x arch I was trying to find ways to disable it without breaking x86. I was hoping there is a better way to fix it other than deleting the line on s390x arch. Lemme know if you have any thoughts.

Thanks again.

@George_Karpenkov, any thoughts?

Could you clarify your question?
Are you saying that it's pointless to test a combination of tsan+asan on s390x, since one (?) of them is not supported on s390x? If my understanding is correct, then yes, LIT has a limitation that REQUIRES/XFAIL directives affect the whole file. If you need a more granular control, the test should be split.