Files
clang-p2996/compiler-rt/test/msan/chained_origin_empty_stack.cpp
Harini0924 643a2080ec [llvm-lit] Fix error in compiler-rt tests when using lit internal shell with env (#102069)
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)
2024-08-13 15:13:51 -07:00

35 lines
792 B
C++

// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -fsanitize-memory-track-origins=2 -O3 %s -o %t && \
// RUN: env MSAN_OPTIONS=store_context_size=1 not %run %t 2>&1 | FileCheck %s
// Test that stack trace for the intermediate store is not empty.
// CHECK: MemorySanitizer: use-of-uninitialized-value
// CHECK: #0 {{.*}} in main
// CHECK: Uninitialized value was stored to memory at
// CHECK: #0 {{.*}} in fn_g
// CHECK-NOT: #1
// CHECK: Uninitialized value was created by an allocation of 'z' in the stack frame
// CHECK: #0 {{.*}} in main
#include <stdio.h>
volatile int x;
__attribute__((noinline))
void fn_g(int a) {
x = a;
}
__attribute__((noinline))
void fn_f(int a) {
fn_g(a);
}
int main(int argc, char *argv[]) {
int volatile z;
fn_f(z);
return x;
}