From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: hjl.tools@gmail.com (H.J. Lu)
Cc: mark.kettenis@xs4all.nl (Mark Kettenis),
jan.kratochvil@redhat.com, Jon.Zhou@jdsu.com,
gdb-patches@sourceware.org
Subject: [rfc] skip_ilp32_tests / skip_lp64_tests predicates (was: Re: support biarch gcore?)
Date: Fri, 09 Jul 2010 15:48:00 -0000 [thread overview]
Message-ID: <201007091548.o69FmNlk015436@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <AANLkTimQRQeRUPtRFiXuU7Z2RWfYItt07gOcZBeAYj9R@mail.gmail.com> from "H.J. Lu" at Jul 08, 2010 06:51:55 AM
H.J. Lu wrote:
> Very good point. There are some arch specific tests which are either
> 32bit or 64bit. Currently, we check target. It doesn't work -m32. We
> need something like
>
> /* { dg-require-effective-target lp64 } */
> /* { dg-require-effective-target ilp32 } */
Right; I noticed this problem with one ppc64 test case as well.
I've tried to add testsuite predicates skip_ilp32_tests and skip_lp64_tests
modeled along the lines of the above GCC effective-target flags, and this
helps with this ppc64 test case.
Could you try whether you can use this to fix the i386/x86_64 tests?
I'd appreciate any comments on the approach below!
Bye,
Ulrich
ChangeLog:
* lib/gdb.exp (skip_ilp32_tests): New procedure.
(skip_lp64_tests): New procedure.
* gdb.arch/ppc64-atomic-inst.exp: Use skip_lp64_tests to execute test
only when building 64-bit executables. Do not hard-code -m64 option.
Index: gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp,v
retrieving revision 1.5
diff -u -p -r1.5 ppc64-atomic-inst.exp
--- gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp 5 May 2010 18:06:57 -0000 1.5
+++ gdb/testsuite/gdb.arch/ppc64-atomic-inst.exp 9 Jul 2010 15:40:41 -0000
@@ -25,7 +25,7 @@ if $tracelevel {
# instruction.
-if ![istarget "powerpc64-*"] then {
+if {![istarget "powerpc*"] || [skip_lp64_tests]} {
verbose "Skipping testing of powerpc64 single stepping over atomic sequences."
return
}
@@ -33,9 +33,9 @@ if ![istarget "powerpc64-*"] then {
set testfile "ppc64-atomic-inst"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-set compile_flags "debug quiet"
+set compile_flags {debug quiet}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat $compile_flags additional_flags=-m64]] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_flags] != "" } {
unsupported "Testcase compile failed."
return -1
}
Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.152
diff -u -p -r1.152 gdb.exp
--- gdb/testsuite/lib/gdb.exp 28 Jun 2010 20:09:59 -0000 1.152
+++ gdb/testsuite/lib/gdb.exp 9 Jul 2010 15:40:42 -0000
@@ -1401,6 +1401,83 @@ proc skip_shlib_tests {} {
return 1
}
+# Return 1 if we should skip tests that assume the ILP32 model.
+# This cannot be decided simply from looking at the target string,
+# as it might depend on externally passed compiler options like -m64.
+proc skip_ilp32_tests {} {
+ global skip_ilp32_tests_saved
+
+ # Use the cached value, if it exists. Cache value per "board" to handle
+ # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
+ set me "skip_ilp32_tests"
+ set board [target_info name]
+ if [info exists skip_ilp32_tests_saved($board)] {
+ verbose "$me: returning saved $skip_ilp32_tests_saved($board)" 2
+ return $skip_ilp32_tests_saved($board)
+ }
+
+
+ set src ilp32[pid].c
+ set obj ilp32[pid].o
+
+ set f [open $src "w"]
+ puts $f "int dummy\[sizeof (int) == 4"
+ puts $f " && sizeof (void *) == 4"
+ puts $f " && sizeof (long) == 4 ? 1 : -1\];"
+ close $f
+
+ verbose "$me: compiling testfile $src" 2
+ set lines [gdb_compile $src $obj object {quiet}]
+ file delete $src
+ file delete $obj
+
+ if ![string match "" $lines] then {
+ verbose "$me: testfile compilation failed, returning 1" 2
+ return [set skip_ilp32_tests_saved($board) 1]
+ }
+
+ verbose "$me: returning 0" 2
+ return [set skip_ilp32_tests_saved($board) 0]
+}
+
+# Return 1 if we should skip tests that assume the LP64 model.
+# This cannot be decided simply from looking at the target string,
+# as it might depend on externally passed compiler options like -m64.
+proc skip_lp64_tests {} {
+ global skip_lp64_tests_saved
+
+ # Use the cached value, if it exists. Cache value per "board" to handle
+ # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
+ set me "skip_lp64_tests"
+ set board [target_info name]
+ if [info exists skip_lp64_tests_saved($board)] {
+ verbose "$me: returning saved $skip_lp64_tests_saved($board)" 2
+ return $skip_lp64_tests_saved($board)
+ }
+
+ set src lp64[pid].c
+ set obj lp64[pid].o
+
+ set f [open $src "w"]
+ puts $f "int dummy\[sizeof (int) == 4"
+ puts $f " && sizeof (void *) == 8"
+ puts $f " && sizeof (long) == 8 ? 1 : -1\];"
+ close $f
+
+ verbose "$me: compiling testfile $src" 2
+ set lines [gdb_compile $src $obj object {quiet}]
+ file delete $src
+ file delete $obj
+
+ if ![string match "" $lines] then {
+ verbose "$me: testfile compilation failed, returning 1" 2
+ return [set skip_lp64_tests_saved($board) 1]
+ }
+
+ verbose "$me: returning 0" 2
+ return [set skip_lp64_tests_saved($board) 0]
+}
+
# Run a test on the target to see if it supports vmx hardware. Return 0 if so,
# 1 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite.
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2010-07-09 15:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201007062128.o66LSkNC032580@glazunov.sibelius.xs4all.nl>
2010-07-07 12:30 ` support biarch gcore? Ulrich Weigand
2010-07-08 2:35 ` Jon Zhou
2010-07-08 11:17 ` Ulrich Weigand
2010-07-08 4:47 ` H.J. Lu
2010-07-08 5:05 ` H.J. Lu
2010-07-08 11:15 ` Ulrich Weigand
2010-07-08 13:52 ` H.J. Lu
2010-07-09 15:48 ` Ulrich Weigand [this message]
2010-07-09 15:56 ` [rfc] skip_ilp32_tests / skip_lp64_tests predicates (was: Re: support biarch gcore?) H.J. Lu
2010-07-09 21:43 ` H.J. Lu
2010-07-09 22:33 ` H.J. Lu
2010-07-12 14:49 ` Ulrich Weigand
2010-07-21 22:45 ` support biarch gcore? Joseph S. Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201007091548.o69FmNlk015436@d12av02.megacenter.de.ibm.com \
--to=uweigand@de.ibm.com \
--cc=Jon.Zhou@jdsu.com \
--cc=gdb-patches@sourceware.org \
--cc=hjl.tools@gmail.com \
--cc=jan.kratochvil@redhat.com \
--cc=mark.kettenis@xs4all.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).