r363052 - Make sure a test from r363036 does not write into a working directory

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 11 05:05:04 PDT 2019


Author: ibiryukov
Date: Tue Jun 11 05:05:03 2019
New Revision: 363052

URL: http://llvm.org/viewvc/llvm-project?rev=363052&view=rev
Log:
Make sure a test from r363036 does not write into a working directory

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.

Modified:
    cfe/trunk/test/Driver/check-time-trace.cpp
    cfe/trunk/tools/driver/cc1_main.cpp

Modified: cfe/trunk/test/Driver/check-time-trace.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/check-time-trace.cpp?rev=363052&r1=363051&r2=363052&view=diff
==============================================================================
--- cfe/trunk/test/Driver/check-time-trace.cpp (original)
+++ cfe/trunk/test/Driver/check-time-trace.cpp Tue Jun 11 05:05:03 2019
@@ -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
 

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=363052&r1=363051&r2=363052&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Tue Jun 11 05:05:03 2019
@@ -240,6 +240,8 @@ int cc1_main(ArrayRef<const char *> Argv
                                 /*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";




More information about the cfe-commits mailing list