When running tests in compiler-rt using the lit internal shell with the following command: ``` LIT_USE_INTERNAL_SHELL=1 ninja check-compiler-rt ``` one common error that occurs is: ``` 'XRAY_OPTIONS=patch_premain=false:verbosity=1': command not found ``` This error, along with over 50 similar "environment variable not found" errors, appears across 35 files in complier-rt. These errors happen because the environment variables are not being set correctly when the internal shell is used, leading to commands failing due to unrecognized environment variables. This patch addresses the issue by using the `env` command to properly set the environment variables before running the tests. By explicitly setting the environment variables through `env`, the internal shell can correctly interpret and apply them, allowing the tests to pass. fixes: #102395 [link to RFC](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179)
25 lines
1014 B
C
25 lines
1014 B
C
// RUN: %clang_dfsan %s -fsanitize-ignorelist=%S/Inputs/flags_abilist.txt -mllvm -dfsan-debug-nonzero-labels -o %t && env DFSAN_OPTIONS=warn_unimplemented=1 %run %t 2>&1 | FileCheck %s
|
|
// RUN: %clang_dfsan %s -fsanitize-ignorelist=%S/Inputs/flags_abilist.txt -mllvm -dfsan-debug-nonzero-labels -o %t && env DFSAN_OPTIONS=warn_unimplemented=0 %run %t 2>&1 | count 0
|
|
// RUN: %clang_dfsan %s -fsanitize-ignorelist=%S/Inputs/flags_abilist.txt -mllvm -dfsan-debug-nonzero-labels -o %t && env DFSAN_OPTIONS=warn_nonzero_labels=1 %run %t 2>&1 | FileCheck --check-prefix=CHECK-NONZERO %s
|
|
|
|
// Tests that flags work correctly.
|
|
|
|
#include <sanitizer/dfsan_interface.h>
|
|
|
|
int f(int i) {
|
|
return i;
|
|
}
|
|
|
|
int main(void) {
|
|
int i = 1;
|
|
dfsan_label i_label = 2;
|
|
dfsan_set_label(i_label, &i, sizeof(i));
|
|
|
|
// CHECK: WARNING: DataFlowSanitizer: call to uninstrumented function f
|
|
// CHECK-NOT: WARNING: DataFlowSanitizer: saw nonzero label
|
|
// CHECK-NONZERO: WARNING: DataFlowSanitizer: saw nonzero label
|
|
f(i);
|
|
|
|
return 0;
|
|
}
|