From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18152 invoked by alias); 9 Jul 2010 15:48:35 -0000 Received: (qmail 18137 invoked by uid 22791); 9 Jul 2010 15:48:34 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL,TW_VM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate6.de.ibm.com (HELO mtagate6.de.ibm.com) (195.212.17.166) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Jul 2010 15:48:28 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.1/8.13.1) with ESMTP id o69FmPJZ005522 for ; Fri, 9 Jul 2010 15:48:25 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o69FmPmR1720490 for ; Fri, 9 Jul 2010 17:48:25 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o69FmOFn015473 for ; Fri, 9 Jul 2010 17:48:25 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id o69FmNlk015436; Fri, 9 Jul 2010 17:48:23 +0200 Message-Id: <201007091548.o69FmNlk015436@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 09 Jul 2010 17:48:23 +0200 Subject: [rfc] skip_ilp32_tests / skip_lp64_tests predicates (was: Re: support biarch gcore?) To: hjl.tools@gmail.com (H.J. Lu) Date: Fri, 09 Jul 2010 15:48:00 -0000 From: "Ulrich Weigand" Cc: mark.kettenis@xs4all.nl (Mark Kettenis), jan.kratochvil@redhat.com, Jon.Zhou@jdsu.com, gdb-patches@sourceware.org In-Reply-To: from "H.J. Lu" at Jul 08, 2010 06:51:55 AM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-07/txt/msg00182.txt.bz2 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