From dfcd07aab62226868e5d8c35baa3227f11c41e08 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Tue, 11 Jun 2019 12:05:03 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363052 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Driver/check-time-trace.cpp | 4 ++-- tools/driver/cc1_main.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/Driver/check-time-trace.cpp b/test/Driver/check-time-trace.cpp index 2b6579ee55..0809108938 100644 --- a/test/Driver/check-time-trace.cpp +++ b/test/Driver/check-time-trace.cpp @@ -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 diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index caf73195fe..2ed27c2270 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -240,6 +240,8 @@ int cc1_main(ArrayRef 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"; -- 2.40.0