From d33ccbfaa9a0b00f31da6dadcd6eb40ef502eb8f Mon Sep 17 00:00:00 2001 From: Harini Date: Fri, 23 Aug 2024 01:04:13 +0000 Subject: [PATCH 1/3] [llvm-lit] Fix command not found error Fixed an issue with the LIBFUZZER_OOP_TARGET environment variable in the out-of-process-fuzz test, which was causing command not found errors. Updated the test to use env for setting the environment variable, captured the fuzzing process output in a temporary file, and appended the output from running oop-target on all corpus files to ensure that all outputs are correctly checked by FileCheck. --- compiler-rt/test/fuzzer/out-of-process-fuzz.test | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler-rt/test/fuzzer/out-of-process-fuzz.test b/compiler-rt/test/fuzzer/out-of-process-fuzz.test index 4bd866061f1fc..2f9557f9c41f3 100644 --- a/compiler-rt/test/fuzzer/out-of-process-fuzz.test +++ b/compiler-rt/test/fuzzer/out-of-process-fuzz.test @@ -14,8 +14,9 @@ RUN: echo %t # Out-of-process fuzzing with this rig is slow, # we can not wait for the fuzzer to find the faulty input. # Just run for a bit and observe the corpus expansion. -RUN: LIBFUZZER_OOP_TARGET="./oop-target > /dev/null 2>&1 " ./oop-fuzzer -max_len=3 OOP_CORPUS -runs=1000 -jobs=4 +RUN: env LIBFUZZER_OOP_TARGET="./oop-target > /dev/null 2>&1 " ./oop-fuzzer -max_len=3 OOP_CORPUS/seed -runs=1000 -jobs=4 > %t/temp_output.txt 2>&1 CHECK: Running: OOP_CORPUS/ CHECK: Running: OOP_CORPUS/ CHECK: Running: OOP_CORPUS/ -RUN: ./oop-target OOP_CORPUS/* 2>&1 | FileCheck %s +RUN: ./oop-target OOP_CORPUS/* >> %t/temp_output.txt 2>&1 +RUN: FileCheck %s < %t/temp_output.txt 2>&1 From fa800444377f6303a0e028a51af7e92f2f037592 Mon Sep 17 00:00:00 2001 From: Harini Date: Fri, 23 Aug 2024 22:51:41 +0000 Subject: [PATCH 2/3] Added `{{.*}}OOP_CORPUS` Resolved an issue where the test was failing due to a full path check instead of a relative one. Updated the test to use `CHECK: Running: {{.*}}OOP_CORPUS`, which correctly matches the expected output and eliminates the "command not found" error. --- compiler-rt/test/fuzzer/out-of-process-fuzz.test | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/compiler-rt/test/fuzzer/out-of-process-fuzz.test b/compiler-rt/test/fuzzer/out-of-process-fuzz.test index 2f9557f9c41f3..9e7fc7c95a482 100644 --- a/compiler-rt/test/fuzzer/out-of-process-fuzz.test +++ b/compiler-rt/test/fuzzer/out-of-process-fuzz.test @@ -14,9 +14,8 @@ RUN: echo %t # Out-of-process fuzzing with this rig is slow, # we can not wait for the fuzzer to find the faulty input. # Just run for a bit and observe the corpus expansion. -RUN: env LIBFUZZER_OOP_TARGET="./oop-target > /dev/null 2>&1 " ./oop-fuzzer -max_len=3 OOP_CORPUS/seed -runs=1000 -jobs=4 > %t/temp_output.txt 2>&1 -CHECK: Running: OOP_CORPUS/ -CHECK: Running: OOP_CORPUS/ -CHECK: Running: OOP_CORPUS/ -RUN: ./oop-target OOP_CORPUS/* >> %t/temp_output.txt 2>&1 -RUN: FileCheck %s < %t/temp_output.txt 2>&1 +RUN: env LIBFUZZER_OOP_TARGET="./oop-target > /dev/null 2>&1 " ./oop-fuzzer -max_len=3 OOP_CORPUS -runs=1000 -jobs=4 +CHECK: Running: {{.*}}OOP_CORPUS +CHECK: Running: {{.*}}OOP_CORPUS +CHECK: Running: {{.*}}OOP_CORPUS +RUN: ./oop-target OOP_CORPUS/* 2>&1 | FileCheck %s From f2087a5a755139c1f6350c50d19c704420c5b3ab Mon Sep 17 00:00:00 2001 From: Harini Date: Fri, 23 Aug 2024 22:56:35 +0000 Subject: [PATCH 3/3] Fixed a typo --- compiler-rt/test/fuzzer/out-of-process-fuzz.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler-rt/test/fuzzer/out-of-process-fuzz.test b/compiler-rt/test/fuzzer/out-of-process-fuzz.test index 9e7fc7c95a482..d239bfac1b9cb 100644 --- a/compiler-rt/test/fuzzer/out-of-process-fuzz.test +++ b/compiler-rt/test/fuzzer/out-of-process-fuzz.test @@ -15,7 +15,7 @@ RUN: echo %t # we can not wait for the fuzzer to find the faulty input. # Just run for a bit and observe the corpus expansion. RUN: env LIBFUZZER_OOP_TARGET="./oop-target > /dev/null 2>&1 " ./oop-fuzzer -max_len=3 OOP_CORPUS -runs=1000 -jobs=4 -CHECK: Running: {{.*}}OOP_CORPUS -CHECK: Running: {{.*}}OOP_CORPUS -CHECK: Running: {{.*}}OOP_CORPUS +CHECK: Running: {{.*}}OOP_CORPUS/ +CHECK: Running: {{.*}}OOP_CORPUS/ +CHECK: Running: {{.*}}OOP_CORPUS/ RUN: ./oop-target OOP_CORPUS/* 2>&1 | FileCheck %s