summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2017-12-05 17:13:17 +0000
committerMatt Morehouse <mascasa@google.com>2017-12-05 17:13:17 +0000
commit056774d13b0f61d19d2c73302bde01261b9ec9c6 (patch)
tree072a6ba81d56973bc0037141bbd7449e5d9d9600
parentdf6ba242bf51979063607a4441f96d1602cad0ae (diff)
downloadbcm5719-llvm-056774d13b0f61d19d2c73302bde01261b9ec9c6.tar.gz
bcm5719-llvm-056774d13b0f61d19d2c73302bde01261b9ec9c6.zip
[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. llvm-svn: 319792
-rw-r--r--compiler-rt/lib/fuzzer/FuzzerCommand.h4
-rw-r--r--compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerCommand.h b/compiler-rt/lib/fuzzer/FuzzerCommand.h
index 358f8909431..c5500ed21fc 100644
--- a/compiler-rt/lib/fuzzer/FuzzerCommand.h
+++ b/compiler-rt/lib/fuzzer/FuzzerCommand.h
@@ -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);
diff --git a/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp b/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp
index bba4fd6b90f..c1129995474 100644
--- a/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp
+++ b/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp
@@ -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) {
OpenPOWER on IntegriCloud