[compiler-rt] r319792 - [libFuzzer] Make redirects happen in proper sequence.
Matt Morehouse via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 5 09:13:17 PST 2017
Author: morehouse
Date: Tue Dec 5 09:13:17 2017
New Revision: 319792
URL: http://llvm.org/viewvc/llvm-project?rev=319792&view=rev
Log:
[libFuzzer] Make redirects happen in proper sequence.
"> file" must come before "2>&1" to have redirection occur correctly in
all cases. Fixes a regression on minimize_two_crashes.test.
Modified:
compiler-rt/trunk/lib/fuzzer/FuzzerCommand.h
compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp
Modified: compiler-rt/trunk/lib/fuzzer/FuzzerCommand.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerCommand.h?rev=319792&r1=319791&r2=319792&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerCommand.h (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerCommand.h Tue Dec 5 09:13:17 2017
@@ -143,10 +143,10 @@ public:
std::stringstream SS;
for (auto arg : getArguments())
SS << arg << " ";
- if (isOutAndErrCombined())
- SS << "2>&1 ";
if (hasOutputFile())
SS << ">" << getOutputFile() << " ";
+ if (isOutAndErrCombined())
+ SS << "2>&1 ";
std::string result = SS.str();
if (!result.empty())
result = result.substr(0, result.length() - 1);
Modified: compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp?rev=319792&r1=319791&r2=319792&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp (original)
+++ compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp Tue Dec 5 09:13:17 2017
@@ -923,7 +923,7 @@ TEST(FuzzerCommand, SetOutput) {
EXPECT_TRUE(Cmd.isOutAndErrCombined());
CmdLine = Cmd.toString();
- EXPECT_EQ(CmdLine, makeCmdLine("", "2>&1 >thud"));
+ EXPECT_EQ(CmdLine, makeCmdLine("", ">thud 2>&1"));
}
int main(int argc, char **argv) {
More information about the llvm-commits
mailing list