Some tests in clang require running non-filechecked commands to generate the actual filecheck input. For example, tests for openmp offloading require generating the host bc without any checking, before running the clang command to actually generate the filechecked IR of the target device. This patch enables update_cc_test_checks.py to run non-filechecked run lines in-place.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks like this breaks tests on mac: http://45.33.8.238/macm1/5075/step_6.txt
Please take a look, and revert for now if it takes a while to fix.
Hey @thakis, it should be an easy fix. I see no check lines are generated and I suspect something may be going wrong with the cp runline, but it's hard to know without replicating it. Is there any way you can give me temporary access to the mac machine to test things out?
Otherwise, I will simplify the test to exclude the cp runline.
IMO this should also handle the %t substitution and create a temporary directory. Otherwise we end up writing files to whatever the current cwd is.
The issue has something to do with Darwin's USER_LABEL_PREFIX mangling inserting an _ prefix. This "fixes" the test, but doesn't solve whatever underlying problem is there:
diff --git a/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c b/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c index bf18179392dc..a0a826c3d0b4 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c +++ b/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c @@ -1,7 +1,7 @@ // Check that the non-clang/non-filechecked runlines execute // RUN: cp %s %s.copy.c -// RUN: %clang_cc1 -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc -// RUN: %clang_cc1 -fopenmp -fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s void use(int); diff --git a/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected index ffc8caac0f23..3ad33fc683bd 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/exec-all-runlines.c.expected @@ -1,8 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // Check that the non-clang/non-filechecked runlines execute // RUN: cp %s %s.copy.c -// RUN: %clang_cc1 -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc -// RUN: %clang_cc1 -fopenmp -fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp %s.copy.c -emit-llvm-bc -o %t-host.bc +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-host-ir-file-path %t-host.bc %s.copy.c -emit-llvm -o - | FileCheck %s void use(int);
You should be able to replicate the failure locally by setting an apple triple instead, i.e. -triple x86_64-apple-macosx.
Reverted in a24644bb1ce09b40c2d751569dd5bb37ea9c995d to get the bots green again. Feel free to re-land with a fix.
@jroelofs, thank you very much for the much useful information. I will try to replicate the problem with the apple triple and fix it, if possible, or otherwise use your patch to avoid the issue.
They're not really spurious, right... Doesn't this mean that utils/update_cc_test_checks.py is now broken for people who develop on a mac?
It's spurious in the sense that it's not this commit that breaks mac tests. Testing on mac is already broken. By investigating the issue, you are right that the USER_LABEL_PREFIX _ is skipping generating the checks because function names mismatch in IR output. I suppose the issue should be fixed by identifying a mac triple and removing the _ prefix?