From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8504 invoked by alias); 10 Mar 2009 14:00:37 -0000 Received: (qmail 8495 invoked by uid 22791); 10 Mar 2009 14:00:36 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mx.transitive.com (HELO mx.transitive.com) (85.91.225.206) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Mar 2009 14:00:25 +0000 Received: by mx.transitive.com (Postfix, from userid 65534) id 8A60B13A68; Tue, 10 Mar 2009 13:57:26 +0000 (GMT) X-Spam-Score: -2.4 Received: from richards-desktop.transitives.com (richards-desktop.transitives.com [192.168.2.43]) by mx.transitive.com (Postfix) with ESMTP id 56ADC13A68 for ; Tue, 10 Mar 2009 13:57:20 +0000 (GMT) Received: from richards-desktop.transitives.com (localhost.localdomain [127.0.0.1]) by richards-desktop.transitives.com (8.13.8/8.13.8) with ESMTP id n2AE0Gf6029812 for ; Tue, 10 Mar 2009 14:00:16 GMT Received: (from richards@localhost) by richards-desktop.transitives.com (8.13.8/8.13.8/Submit) id n2AE0GO4029811; Tue, 10 Mar 2009 14:00:16 GMT From: Richard Sandiford To: binutils@sourceware.org Mail-Followup-To: binutils@sourceware.org, richards@transitive.com Subject: [1/21] Fix handling of archive tests References: Date: Tue, 10 Mar 2009 14:00:00 -0000 In-Reply-To: (Richard Sandiford's message of "Tue\, 10 Mar 2009 13\:58\:06 +0000") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2009-03/txt/msg00173.txt.bz2 I was using run_ld_link_tests to create an archive and noticed that it ran both ar _and_ ld. It runs ld first, so everything works out OK in the end, but it's easy to fix. I would have applied that bit as obvious. However, I also wanted to be able to pass specific flags to "ar". The "ld_options" field is currently unused for ar tests, so it seemed natural to overload that. AFAICT, no existing ar tests currently set this field to a nonempty string. OK to install? Richard ld/testsuite/ * lib/ld-lib.exp (ar_simple_create): Add an "aropts" parameter. (run_ld_link_tests): Treat the second list element as "ar" options when creating an archive. Don't run the linker in this case. (run_cc_link_tests): Likewise. Index: ld/testsuite/lib/ld-lib.exp =================================================================== --- ld/testsuite/lib/ld-lib.exp 2009-03-10 13:40:02.000000000 +0000 +++ ld/testsuite/lib/ld-lib.exp 2009-03-10 13:42:09.000000000 +0000 @@ -1095,10 +1095,10 @@ proc file_contents { filename } { # Create an archive using ar # -proc ar_simple_create { ar target objects } { +proc ar_simple_create { ar aropts target objects } { remote_file host delete $target - set exec_output [run_host_cmd "$ar" "rc $target $objects"] + set exec_output [run_host_cmd "$ar" "$aropts rc $target $objects"] set exec_output [prune_warnings $exec_output] if [string match "" $exec_output] then { @@ -1111,7 +1111,7 @@ proc ar_simple_create { ar target object # List contains test-items with 3 items followed by 2 lists, one item and # one optional item: -# 0:name 1:ld options 2:assembler options +# 0:name 1:ld/ar options 2:assembler options # 3:filenames of assembler files 4: action and options. 5: name of output file # 6:compiler flags (optional) # @@ -1178,14 +1178,14 @@ proc run_ld_link_tests { ldtests } { continue } - if [regexp ".*a$" $binfile] then { - if ![ar_simple_create $ar $binfile "$objfiles"] { + if { [regexp ".*a$" $binfile] } { + if { ![ar_simple_create $ar $ld_options $binfile "$objfiles"] } { fail $testname set failed 1 } else { set failed 0 } - } elseif ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles"] { + } elseif { ![ld_simple_link $ld $binfile "-L$srcdir/$subdir $ld_options $objfiles"] } { fail $testname set failed 1 } else { @@ -1434,7 +1434,7 @@ proc run_ld_link_exec_tests { targets_to # List contains test-items with 3 items followed by 2 lists, one item and # one optional item: # 0:name -# 1:link options +# 1:ld or ar options # 2:compile options # 3:filenames of source files # 4:action and options. @@ -1495,14 +1495,14 @@ proc run_cc_link_tests { ldtests } { set cc_cmd $CC } - if [regexp ".*a$" $binfile] then { - if ![ar_simple_create $ar $binfile "$objfiles"] { + if { [regexp ".*a$" $binfile] } { + if { ![ar_simple_create $ar $ldflags $binfile "$objfiles"] } { fail $testname set failed 1 } else { set failed 0 } - } elseif ![ld_simple_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"] { + } elseif { ![ld_simple_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"] } { fail $testname set failed 1 } else {