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.

llvm-svn: 363052
This commit is contained in:
Ilya Biryukov 2019-06-11 12:05:03 +00:00
parent 7bd5c55cad
commit 1f6c602704
2 changed files with 4 additions and 2 deletions

View 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

View 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";