aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2016-08-09 02:47:25 +0000
committerAndi Kleen <ak@gcc.gnu.org>2016-08-09 02:47:25 +0000
commitc43c51121622bf2c488df6b57196de11a56e7671 (patch)
treede7e2c2beef084535f68f160a0ce7d32c2b15294
parent5e1a1c978f8e12b333979c93be32b7f92a0be1b7 (diff)
downloadgcc-c43c51121622bf2c488df6b57196de11a56e7671.zip
gcc-c43c51121622bf2c488df6b57196de11a56e7671.tar.gz
gcc-c43c51121622bf2c488df6b57196de11a56e7671.tar.bz2
Make autofdo tests safer for parallel builds
There were some reports that the autofdo tests are non deterministic with parallel builds. I wasn't able to reproduce this, but here are two changes that may help: - Always use unique file names for temporary files. - Don't print file names in the test log because the directories can vary (suggested by Jeff Law) gcc/testsuite/: 2016-08-08 Andi Kleen <ak@linux.intel.com> * lib/profopt.exp: (auto-profopt-execute): Don't include full test command line in failure log. (profopt-execute): dito. Make autofdo file names unique. From-SVN: r239265
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/lib/profopt.exp26
2 files changed, 20 insertions, 12 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 777315e..c00824d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2016-08-08 Andi Kleen <ak@linux.intel.com>
+
+ * lib/profopt.exp: (auto-profopt-execute): Don't include full
+ test command line in failure log.
+ (profopt-execute): dito. Make autofdo file names unique.
+
2016-08-08 David Malcolm <dmalcolm@redhat.com>
PR c/64955
diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
index 7e45dd44..7c3228a 100644
--- a/gcc/testsuite/lib/profopt.exp
+++ b/gcc/testsuite/lib/profopt.exp
@@ -283,7 +283,7 @@ proc auto-profopt-execute { src } {
if { ! [check_profiling_available "-fauto-profile"] } {
regsub "(?q)$srcdir/" $src "" testcase
- unsupported "$testcase"
+ unsupported "$src -fauto-profile"
return
}
set profile_wrapper [profopt-perf-wrapper]
@@ -388,7 +388,7 @@ proc profopt-execute { src } {
# valid, by running it after dg-additional-files-options.
foreach ext $prof_ext {
profopt-target-cleanup $tmpdir $base $ext
- profopt-target-cleanup $tmpdir perf data
+ profopt-target-cleanup $tmpdir $base "perf.data"
}
# Tree profiling requires TLS runtime support, which may need
@@ -417,8 +417,8 @@ proc profopt-execute { src } {
}
set orig_ld_library_path "[getenv LD_LIBRARY_PATH]"
setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
- verbose -log "Running $profile_wrapper $execname1"
- set id [remote_spawn "" "$profile_wrapper $execname1" "readonly"]
+ verbose -log "Running $profile_wrapper -o $tmpdir/$base.perf.data $execname1"
+ set id [remote_spawn "" "$profile_wrapper -o $tmpdir/$base.perf.data $execname1" "readonly"]
setenv LD_LIBRARY_PATH $orig_ld_library_path
if { $id < 0 } {
warning "Failed to run profiler"
@@ -439,15 +439,17 @@ proc profopt-execute { src } {
}
set missing_file 0
+ set bprefix ""
# Make sure the profile data was generated, and fail if not.
if { $status == "pass" } {
# convert profile
if { $run_autofdo == 1 } {
- set cmd "create_gcov --binary $execname1 --profile=perf.data -gcov_version=1 --gcov=$tmpdir/$base.$ext"
+ set bprefix "afdo."
+ set cmd "create_gcov --binary $execname1 --profile=$tmpdir/$base.perf.data -gcov_version=1 --gcov=$tmpdir/$bprefix$base.$ext"
verbose "Running $cmd"
set id [remote_spawn "" $cmd]
if { $id < 0 } {
- unsupported "$testcase: Cannot run $cmd"
+ unsupported "$src -fauto-profile: cannot run create_gcov"
set status "fail"
return
}
@@ -456,12 +458,12 @@ proc profopt-execute { src } {
}
foreach ext $prof_ext {
- remote_upload target $tmpdir/$base.$ext
- set files [glob -nocomplain $base.$ext]
+ remote_upload target $tmpdir/$bprefix$base.$ext
+ set files [glob -nocomplain $bprefix$base.$ext]
if { $files == "" } {
set status "fail"
set missing_file 1
- fail "$testcase execution: file $base.$ext does not exist, $option $profile_option"
+ fail "$testcase execution: file $bprefix$base.$ext does not exist, $option $profile_option"
}
}
}
@@ -490,7 +492,7 @@ proc profopt-execute { src } {
lappend options "additional_flags=$option $extra_flags $feedback_option"
set optstr "$option $feedback_option"
if { [string first "-fauto-profile" $options] >= 0} {
- set options [regsub -- "-fauto-profile" $options "-fauto-profile=$tmpdir/$base.$ext"]
+ set options [regsub -- "-fauto-profile" $options "-fauto-profile=$tmpdir/$bprefix$base.$ext"]
}
set comp_output [${tool}_target_compile "$src" "$execname2" "executable" $options]
@@ -516,8 +518,8 @@ proc profopt-execute { src } {
# Remove the profiling data files.
foreach ext $prof_ext {
- profopt-target-cleanup $tmpdir $base $ext
- profopt-target-cleanup $tmpdir perf data
+ profopt-target-cleanup $tmpdir "$bprefix$base" $ext
+ profopt-target-cleanup $tmpdir $base "perf.data"
profopt-target-cleanup $tmpdir $base "gcda.imports"
}