[PATCH] D52638: [XRay] Fix fdr-thread-order.cc when current directory contains fdr-thread-order.cc

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 27 17:21:44 PDT 2018


MaskRay created this revision.
MaskRay added reviewers: dberris, mboerger, eizan.
Herald added subscribers: Sanitizers, llvm-commits, delcypher.

Currently,

  cd test/xray/TestCases/Posix
  $build/bin/llvm-lit fdr-thread-order.cc

fails because `rm fdr-thread-order.*` deletes the .cc file.

This patch uses:

- %t as temporary directory name containing log files
- %t.exe as executable name

it does not delete %t after the test finishes for debugging convenience
if something goes wrong. This matches the behavior of many other LLVM
components.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D52638

Files:
  test/xray/TestCases/Posix/fdr-thread-order.cc


Index: test/xray/TestCases/Posix/fdr-thread-order.cc
===================================================================
--- test/xray/TestCases/Posix/fdr-thread-order.cc
+++ test/xray/TestCases/Posix/fdr-thread-order.cc
@@ -1,15 +1,12 @@
-// RUN: %clangxx_xray -g -std=c++11 %s -o %t
-// RUN: rm fdr-thread-order.* || true
+// RUN: rm -rf %t && mkdir %t
+// RUN: %clangxx_xray -g -std=c++11 %s -o %t.exe
 // RUN: XRAY_OPTIONS="patch_premain=false xray_naive_log=false \
-// RUN:    xray_logfile_base=fdr-thread-order. xray_fdr_log=true verbosity=1 \
-// RUN:    xray_fdr_log_func_duration_threshold_us=0" %run %t 2>&1 | \
+// RUN:    xray_logfile_base=%t/ xray_fdr_log=true verbosity=1 \
+// RUN:    xray_fdr_log_func_duration_threshold_us=0" %run %t.exe 2>&1 | \
 // RUN:    FileCheck %s
-// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \
-// RUN:    "`ls fdr-thread-order.* | head -1`"
-// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t \
-// RUN:    "`ls fdr-thread-order.* | head -1`" | \
-// RUN:    FileCheck %s --check-prefix TRACE
-// RUN: rm fdr-thread-order.*
+// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t.exe %t/*
+// RUN: %llvm_xray convert --symbolize --output-format=yaml -instr_map=%t.exe %t/* | \
+// RUN:   FileCheck %s --check-prefix TRACE
 // FIXME: Make llvm-xray work on non-x86_64 as well.
 // REQUIRES: x86_64-target-arch
 // REQUIRES: built-in-llvm-tree


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52638.167417.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180928/5f6eefaf/attachment.bin>


More information about the llvm-commits mailing list