[compiler-rt] f8ed31c - [Fuzzer][Test] Use %python substitution for trace-malloc-unbalanced.test

Greg Bedwell via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 07:12:21 PST 2021


Author: Jonny Farley
Date: 2021-02-17T15:00:46Z
New Revision: f8ed31cd991bf84372369409595707f6e3cebbce

URL: https://github.com/llvm/llvm-project/commit/f8ed31cd991bf84372369409595707f6e3cebbce
DIFF: https://github.com/llvm/llvm-project/commit/f8ed31cd991bf84372369409595707f6e3cebbce.diff

LOG: [Fuzzer][Test] Use %python substitution for trace-malloc-unbalanced.test

This test was found to fail for some of our downstream builds, on
computers where python was not on the default $PATH. Therefore
add a %python substitution to use sys.executable, based on similar
solutions for python calls in tests elsewhere in LLVM.

Differential Revision: https://reviews.llvm.org/D96799

Added: 
    

Modified: 
    compiler-rt/test/fuzzer/lit.cfg.py
    compiler-rt/test/fuzzer/trace-malloc-unbalanced.test

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/fuzzer/lit.cfg.py b/compiler-rt/test/fuzzer/lit.cfg.py
index 00871b8a94a31..d114ae7937fa1 100644
--- a/compiler-rt/test/fuzzer/lit.cfg.py
+++ b/compiler-rt/test/fuzzer/lit.cfg.py
@@ -61,6 +61,8 @@
 libfuzzer_src_root = os.path.join(config.compiler_rt_src_root, "lib", "fuzzer")
 config.substitutions.append(('%libfuzzer_src', libfuzzer_src_root))
 
+config.substitutions.append(('%python', '"%s"' % (sys.executable)))
+
 def generate_compiler_cmd(is_cpp=True, fuzzer_enabled=True, msan_enabled=False):
   compiler_cmd = config.clang
   extra_cmd = config.target_flags

diff  --git a/compiler-rt/test/fuzzer/trace-malloc-unbalanced.test b/compiler-rt/test/fuzzer/trace-malloc-unbalanced.test
index c7b4632140cbe..395386ab5cd27 100644
--- a/compiler-rt/test/fuzzer/trace-malloc-unbalanced.test
+++ b/compiler-rt/test/fuzzer/trace-malloc-unbalanced.test
@@ -8,10 +8,10 @@ RUN: %cpp_compiler %S/TraceMallocTest.cpp -o %t-TraceMallocTest
 
 # Specify python because we can't use the shebang line on Windows.
 RUN: %run %t-TraceMallocTest -seed=1 -trace_malloc=1 -runs=200 2>&1 | \
-RUN:    python %libfuzzer_src/scripts/unbalanced_allocs.py --skip=5 | FileCheck %s
+RUN:    %python %libfuzzer_src/scripts/unbalanced_allocs.py --skip=5 | FileCheck %s
 
 RUN: %run %t-TraceMallocTest -seed=1 -trace_malloc=2 -runs=200 2>&1 | \
-RUN:    python %libfuzzer_src/scripts/unbalanced_allocs.py --skip=5 | FileCheck %s --check-prefixes=CHECK,CHECK2
+RUN:    %python %libfuzzer_src/scripts/unbalanced_allocs.py --skip=5 | FileCheck %s --check-prefixes=CHECK,CHECK2
 
 CHECK: MallocFreeTracer: START
 # Behavior of the format string "%p" is implementation defined. Account for the


        


More information about the llvm-commits mailing list