[testsuite] Skip gnu-ifunc tests if building the testcase fails

Message ID 0416cc5d-337b-82ae-5f37-07f28eaa35b3@codesourcery.com
State New, archived
Headers

Commit Message

Sandra Loosemore Sept. 26, 2018, 5:08 a.m. UTC
  gdb.base/gnu-ifunc.exp doesn't fail gracefully on targets that don't 
support this feature -- on nios2-linux-gnu I've seen TCL errors from 
trying to copy the nonexistent shared library that fails to build to the 
target.

I see that ld/testsuite/ld-ifunc/ifunc.exp explicitly lists all the 
targets where IFUNC is expected to work, but it seemed more maintainable 
to me to tweak these gdb tests to pay attention to the return status 
from trying to build the test cases.  Is this OK to commit?

-Sandra
  

Comments

Rainer Orth Sept. 26, 2018, 11:50 a.m. UTC | #1
Hi Sandra,

> gdb.base/gnu-ifunc.exp doesn't fail gracefully on targets that don't
> support this feature -- on nios2-linux-gnu I've seen TCL errors from trying
> to copy the nonexistent shared library that fails to build to the target.

I just tried the patch on Solaris which also doesn't have (and never
will have) ifunc support: unfortunately, there's still lots of noise in
gdb.sum:

Running /vol/src/gnu/gdb/hg/master/local/gdb/testsuite/gdb.base/gnu-ifunc.exp ...
gdb compile failed, ld: warning: relocation error: 0xa: file /var/tmp//ccyG.via.o: symbol gnu_ifunc: unexpected symbol referenced from file /vol/obj/gnu/gdb/gdb/11.5-amd64-local/gdb/testsuite/outputs/gdb.base/gnu-ifunc/gnu-ifunc-lib-0-0-0.so
ld: warning: relocation error: 0xa: file /var/tmp//ccyG.via.o: symbol gnu_ifunc: unexpected symbol referenced from file /vol/obj/gnu/gdb/gdb/11.5-amd64-local/gdb/testsuite/outputs/gdb.base/gnu-ifunc/gnu-ifunc-lib-0-0-0.so
warning: Text relocation remains        	referenced
    against symbol		    offset	in file
gnu_ifunc                           0x55      	/var/tmp//ccyG.via.o
gnu_ifunc                           0x81      	/var/tmp//ccyG.via.o
UNTESTED: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=0: final_debug=0: failed to compile testcase
gdb compile failed, ld: warning: relocation error: 0xa: file /var/tmp//ccD64Npa.o: symbol gnu_ifunc: unexpected symbol referenced from file /vol/obj/gnu/gdb/gdb/11.5-amd64-local/gdb/testsuite/outputs/gdb.base/gnu-ifunc/gnu-ifunc-lib-0-0-1.so
ld: warning: relocation error: 0xa: file /var/tmp//ccD64Npa.o: symbol gnu_ifunc: unexpected symbol referenced from file /vol/obj/gnu/gdb/gdb/11.5-amd64-local/gdb/testsuite/outputs/gdb.base/gnu-ifunc/gnu-ifunc-lib-0-0-1.so
warning: Text relocation remains        	referenced
    against symbol		    offset	in file
gnu_ifunc                           0x55      	/var/tmp//ccD64Npa.o
gnu_ifunc                           0x81      	/var/tmp//ccD64Npa.o
UNTESTED: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=0: final_debug=1: failed to compile testcase
gdb compile failed, ld: warning: relocation error: 0xa: file /var/tmp//ccLB0Wba.o: symbol gnu_ifunc: unexpected symbol referenced from file /vol/obj/gnu/gdb/gdb/11.5-amd64-local/gdb/testsuite/outputs/gdb.base/gnu-ifunc/gnu-ifunc-lib-0-1-0.so
ld: warning: relocation error: 0xa: file /var/tmp//ccLB0Wba.o: symbol gnu_ifunc: unexpected symbol referenced from file /vol/obj/gnu/gdb/gdb/11.5-amd64-local/gdb/testsuite/outputs/gdb.base/gnu-ifunc/gnu-ifunc-lib-0-1-0.so
warning: Text relocation remains        	referenced
    against symbol		    offset	in file
gnu_ifunc                           0x55      	/var/tmp//ccLB0Wba.o
gnu_ifunc                           0x81      	/var/tmp//ccLB0Wba.o
UNTESTED: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: final_debug=0: failed to compile testcase
gdb compile failed, ld: warning: relocation error: 0xa: file /var/tmp//ccxKrUka.o: symbol gnu_ifunc: unexpected symbol referenced from file /vol/obj/gnu/gdb/gdb/11.5-amd64-local/gdb/testsuite/outputs/gdb.base/gnu-ifunc/gnu-ifunc-lib-0-1-1.so
ld: warning: relocation error: 0xa: file /var/tmp//ccxKrUka.o: symbol gnu_ifunc: unexpected symbol referenced from file /vol/obj/gnu/gdb/gdb/11.5-amd64-local/gdb/testsuite/outputs/gdb.base/gnu-ifunc/gnu-ifunc-lib-0-1-1.so
warning: Text relocation remains        	referenced
    against symbol		    offset	in file
gnu_ifunc                           0x55      	/var/tmp//ccxKrUka.o
gnu_ifunc                           0x81      	/var/tmp//ccxKrUka.o
UNTESTED: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: final_debug=1: failed to compile testcase
gdb compile failed, /vol/src/gnu/gdb/hg/master/local/gdb/testsuite/gdb.base/gnu-ifunc-lib.c:44:22: error: ifunc is not supported on this target
 __typeof (gnu_ifunc) gnu_ifunc __attribute__ ((ifunc ("gnu_ifunc_resolver")));
                      ^~~~~~~~~
UNTESTED: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=0: final_debug=0: failed to compile testcase
gdb compile failed, /vol/src/gnu/gdb/hg/master/local/gdb/testsuite/gdb.base/gnu-ifunc-lib.c:44:22: error: ifunc is not supported on this target
 __typeof (gnu_ifunc) gnu_ifunc __attribute__ ((ifunc ("gnu_ifunc_resolver")));
                      ^~~~~~~~~
UNTESTED: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=0: final_debug=1: failed to compile testcase
gdb compile failed, /vol/src/gnu/gdb/hg/master/local/gdb/testsuite/gdb.base/gnu-ifunc-lib.c:44:22: error: ifunc is not supported on this target
 __typeof (gnu_ifunc) gnu_ifunc __attribute__ ((ifunc ("gnu_ifunc_resolver")));
                      ^~~~~~~~~
UNTESTED: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=1: final_debug=0: failed to compile testcase
gdb compile failed, /vol/src/gnu/gdb/hg/master/local/gdb/testsuite/gdb.base/gnu-ifunc-lib.c:44:22: error: ifunc is not supported on this target
 __typeof (gnu_ifunc) gnu_ifunc __attribute__ ((ifunc ("gnu_ifunc_resolver")));
                      ^~~~~~~~~
UNTESTED: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=1: final_debug=1: failed to compile testcase
PASS: gdb.base/gnu-ifunc.exp: static: static gnu_ifunc

		=== gdb Summary ===

# of expected passes		1
# of untested testcases		8

It would be good to further reduce this.

Btw., shouldn't gdb.compile/compile-ifunc.exp get similar treatment?

> I see that ld/testsuite/ld-ifunc/ifunc.exp explicitly lists all the targets
> where IFUNC is expected to work, but it seemed more maintainable to me to
> tweak these gdb tests to pay attention to the return status from trying to
> build the test cases.  Is this OK to commit?

gcc has gcc/testsuite/lib/target-supports.exp (check_ifunc_available)
instead, again a compile test instead of a hardcoded list.  I wonder,
though, if it wouldn't be better to run such a check early in the two
gdb ifunc tests and skip them if that fails, rather than producing lots
of noise and UNSUPPORTED tests?

	Rainer
  

Patch

commit 1e4269b8d83d6c8cdb5351efa2b346a714a250aa
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Tue Sep 25 21:54:52 2018 -0700

    Skip gnu-ifunc tests if building the testcase fails.
    
    2018-09-25  Sandra Loosemore  <sandra@codesourcery.com>
    
    	* gdb.base/gnu-ifunc.exp: Skip tests if building testcase fails.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d15fcff..72bf6bd 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@ 
+2018-09-25  Sandra Loosemore  <sandra@codesourcery.com>
+
+	* gdb.base/gnu-ifunc.exp: Skip tests if building testcase fails.
+
 2018-09-24  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
 
 	PR gdb/20948
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp
index d6ec698..ffaf254 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc.exp
+++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp
@@ -365,9 +365,10 @@  proc misc_tests {resolver_attr resolver_debug final_debug} {
 foreach_with_prefix resolver_attr {0 1} {
     foreach_with_prefix resolver_debug {0 1} {
 	foreach_with_prefix final_debug {0 1} {
-	    build $resolver_attr $resolver_debug $final_debug
-	    misc_tests $resolver_attr $resolver_debug $final_debug
-	    set-break $resolver_attr $resolver_debug $final_debug
+	    if { [build $resolver_attr $resolver_debug $final_debug] != 0 } {
+		misc_tests $resolver_attr $resolver_debug $final_debug
+		set-break $resolver_attr $resolver_debug $final_debug
+	    }
 	}
     }
 }