Check file exists before completion tests

Message ID 1396414296-26669-1-git-send-email-yao@codesourcery.com
State Committed
Headers

Commit Message

Yao Qi April 2, 2014, 4:51 a.m. UTC
  Doug told me that there are some regressions in gdb.base/completion.exp.
They are caused by my recent change, and can be reproduced via:

$ make check-parallel TESTS=gdb.base/completion.exp
FAIL: gdb.base/completion.exp: complete target core ./gdb.base/completion
FAIL: gdb.base/completion.exp: complete target tfile ./gdb.base/completion
FAIL: gdb.base/completion.exp: complete target exec ./gdb.base/completion

Current tests assume that gdb.base/completion exists but that is wrong
in a parallel run, because binary file and object files are placed
in outputs/gdb.base/completion/.

This patch is to check file exists on two candidate directories,
"gdb.base" and "outputs/gdb.base/completion/", and run tests with files
existed in either of them.

OK?

gdb/testsuite:

2014-04-02  Yao Qi  <yao@codesourcery.com>

	* gdb.base/completion.exp: Check file exists before running tests
	on file completion.
---
 gdb/testsuite/gdb.base/completion.exp |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
  

Comments

Yao Qi April 10, 2014, 2:47 a.m. UTC | #1
On 04/02/2014 12:51 PM, Yao Qi wrote:
> Doug told me that there are some regressions in gdb.base/completion.exp.
> They are caused by my recent change, and can be reproduced via:
> 
> $ make check-parallel TESTS=gdb.base/completion.exp
> FAIL: gdb.base/completion.exp: complete target core ./gdb.base/completion
> FAIL: gdb.base/completion.exp: complete target tfile ./gdb.base/completion
> FAIL: gdb.base/completion.exp: complete target exec ./gdb.base/completion
> 
> Current tests assume that gdb.base/completion exists but that is wrong
> in a parallel run, because binary file and object files are placed
> in outputs/gdb.base/completion/.
> 
> This patch is to check file exists on two candidate directories,
> "gdb.base" and "outputs/gdb.base/completion/", and run tests with files
> existed in either of them.
> 
> OK?
> 
> gdb/testsuite:
> 
> 2014-04-02  Yao Qi  <yao@codesourcery.com>
> 
> 	* gdb.base/completion.exp: Check file exists before running tests
> 	on file completion.

Ping.  https://sourceware.org/ml/gdb-patches/2014-04/msg00019.html
  
Joel Brobecker April 10, 2014, 1 p.m. UTC | #2
> > 2014-04-02  Yao Qi  <yao@codesourcery.com>
> > 
> > 	* gdb.base/completion.exp: Check file exists before running tests
> > 	on file completion.
> 
> Ping.  https://sourceware.org/ml/gdb-patches/2014-04/msg00019.html

I don't see any other choice in this case, so go ahead and commit.
  
Yao Qi April 11, 2014, 5:27 a.m. UTC | #3
On 04/10/2014 09:00 PM, Joel Brobecker wrote:
>>> 2014-04-02  Yao Qi  <yao@codesourcery.com>
>>>
>>> 	* gdb.base/completion.exp: Check file exists before running tests
>>> 	on file completion.
>>
>> Ping.  https://sourceware.org/ml/gdb-patches/2014-04/msg00019.html
> 
> I don't see any other choice in this case, so go ahead and commit.
> 

Thanks, Joel.  Patch is pushed in.
  

Patch

diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 73e3a06..ff2dfd4 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -105,9 +105,18 @@  gdb_test_multiple "target ctf" "" {
     }
 }
 
-foreach target_name ${targets} {
-    gdb_test "complete target ${target_name} ./gdb.base/completion" \
-	"target ${target_name} \\./gdb.base/completion.*\\./gdb.base/completion0\\.o.*\\./gdb.base/completion1\\.o.*"
+# Test artifacts are put in different locations depending on test
+# is a parallel run or not.  Firstly check file exists, and then
+# do the test on file completion.
+
+foreach dir1 [ list "./gdb.base" "./outputs/gdb.base/completion" ] {
+    if [remote_file host exists ${dir1}/completion] {
+	foreach target_name ${targets} {
+	    gdb_test "complete target ${target_name} ${dir1}/completion" \
+		"target ${target_name} ${dir1}/completion.*${dir1}/completion0\\.o.*${dir1}/completion1\\.o.*"
+	}
+	break
+    }
 }
 
 #