]> granicus.if.org Git - clang/commitdiff
Make sure a test from r363036 does not write into a working directory
authorIlya Biryukov <ibiryukov@google.com>
Tue, 11 Jun 2019 12:05:03 +0000 (12:05 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Tue, 11 Jun 2019 12:05:03 +0000 (12:05 +0000)
It breaks if build directory is not writable. This change is required
to fix our integrate.

Also add a flush() call, otherwise time trace option does not produce
the full output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363052 91177308-0d34-0410-b5e6-96231b3b80d8

test/Driver/check-time-trace.cpp
tools/driver/cc1_main.cpp

index 2b6579ee5528ed94371c7bb5031c2f3685c136fb..08091089387646dcfb801efd7f9d46e76962c4a9 100644 (file)
@@ -1,6 +1,6 @@
 // REQUIRES: shell
-// RUN: %clangxx -S -ftime-trace -mllvm --time-trace-granularity=0 %s 2>&1 \
-// RUN:   | grep "Time trace json-file dumped to" | awk '{print $NF}' | xargs cat \
+// RUN: %clangxx -S -ftime-trace -mllvm --time-trace-granularity=0 -o %T/check-time-trace %s
+// RUN: cat %T/check-time-trace.json \
 // RUN:   | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
 // RUN:   | FileCheck %s
 
index caf73195fe54767d9aaa15737ce112644c99d493..2ed27c22708aa039467ac54f9096c86f1589323e 100644 (file)
@@ -240,6 +240,8 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
                                 /*useTemporary=*/false);
 
     llvm::timeTraceProfilerWrite(*profilerOutput);
+    // FIXME(ibiryukov): make profilerOutput flush in destructor instead.
+    profilerOutput->flush();
     llvm::timeTraceProfilerCleanup();
 
     llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";