From patchwork Wed Sep 11 12:44:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1160955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-508847-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=golang.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="d2+BfSD5"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=golang-org.20150623.gappssmtp.com header.i=@golang-org.20150623.gappssmtp.com header.b="FeiofBkD"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46T1nW0076z9s4Y for ; Wed, 11 Sep 2019 22:44:46 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=Cn9OFxBFSkxzKmLuY2pCp0uTj4McyjgqXOXtrM0D/jHboW dMoVIC9IBMf6FVK4e4muHf+mzui8q3jTa8d2Pfwoll3jt8O4RC6s7c9zBz4PKv3m cw+QlO4l+ZgF/TBunBaa1rR5nLBYa7DfzIBFZOCEGqdnecKkz72yVMuWzZuf4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=qIZcr8x2M1H3Z0UbHMnfLa2Ejn0=; b=d2+BfSD5V36uMLFQOKMl hlE6pmRgFOHXhBIW5NGfllEKcT8k8wcom9a2ltvXxqzeJCMVY3+r9vIndd4R4yPj iSU38OeyN09sL03shxOaGSEmChn75E6c0gOKL9lUjDZUApXUW3uHbLOnM/NTI0HT AJwu64xQ17H0cdGvZtWUtRQ= Received: (qmail 21055 invoked by alias); 11 Sep 2019 12:44:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 20800 invoked by uid 89); 11 Sep 2019 12:44:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Received:aa7 X-HELO: mail-ed1-f46.google.com Received: from mail-ed1-f46.google.com (HELO mail-ed1-f46.google.com) (209.85.208.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Sep 2019 12:44:38 +0000 Received: by mail-ed1-f46.google.com with SMTP id i8so20447433edn.13 for ; Wed, 11 Sep 2019 05:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=64mBdddYF83Fo6Zst6O1Xf/8Pk16VzPRgllFjFGSCSs=; b=FeiofBkDVdKYWrTtot7RdxIhY2VD2VFGzZipZ9LL1OdA07GUBgbf29W3FCjMV3PwaB RpG2FYfQgqF4zfHm8cgq3JQIT6tY73P6fd/nlbFUFCAQmDplyFikp0V4nvK8JJsLjm7S a2eQDMXtzs5hF7nd7u5dzhSMGalkVwYd466RLTjS9p9nxsqBVely1FEyTomMkIBIUTS6 5tZiERnCnsvTQUhoClU1Q8iW2zAKH1wt1e4BdPd5kCYYkQfMw7CPe4g7QoJwOwm18Ywq PziTxOhgA3Ad1KSYaXZxLxgGozaN4enpDveMviIpnKBnZBsURME6fGl/0boacma3ZybE geBw== MIME-Version: 1.0 From: Ian Lance Taylor Date: Wed, 11 Sep 2019 05:44:24 -0700 Message-ID: Subject: libgo patch committed: Force test package to be imported first To: gcc-patches , gofrontend-dev When running libgo tests, when compiling the x_test package, this patch forces the test package to be imported first. That ensures that we will see the types defined in the test package before the types defined in the non-test version of the package. This matters if the types differ in some way, such as by adding a new method. This avoids a failure in internal/poll on Solaris, in which the test package adds a method to a type (FD.EOFError). I think it was Solaris-specific because files are sorted in a different order by default. The go tool handles this kind of thing correctly, by rebuilding dependent packages. This is just a hack sufficient to run the libgo testsuite without using the go tool. This fixes PR 91712. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Ran the failing test on Solaris. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 275611) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -bf4832d604e7522dee78fca76de220b62a131d54 +1f4ce28409a2d9d4045b1085de55c46de8759d1c The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/testsuite/gotest =================================================================== --- libgo/testsuite/gotest (revision 275594) +++ libgo/testsuite/gotest (working copy) @@ -419,10 +419,12 @@ esac # Split $gofiles into external gofiles (those in *_test packages) # and internal ones (those in the main package). xgofiles= +xpackage= for f in $gofiles; do package=`grep '^package[ ]' $f | sed 1q` case "$package" in *_test) + xpackage=`echo $package | sed -e 's/package[ ]//' -e 's/[ ]*$//'` xgofiles="$xgofiles $f" ;; *) @@ -471,10 +473,17 @@ $GC -g $pkgpatharg $prefixarg -c -I . -f if $havex; then mkdir -p `dirname $package` cp _gotest_.o `dirname $package`/lib`basename $package`.a + + # Force the test version of the package to be imported first, + # so that it's type definitions will be used, in case any new + # methods appear in export_test.go files. + echo "package $xpackage" > _first_test.go + echo 'import _ "'$package'"' >> _first_test.go + if test "$trace" = "true"; then - echo $GC -g $xpkgpatharg -c -I . -fno-toplevel-reorder -o $xofile $xgofiles + echo $GC -g $xpkgpatharg -c -I . -fno-toplevel-reorder -o $xofile _first_test.go $xgofiles fi - $GC -g $xpkgpatharg -c -I . -fno-toplevel-reorder -o $xofile $xgofiles + $GC -g $xpkgpatharg -c -I . -fno-toplevel-reorder -o $xofile _first_test.go $xgofiles fi # They all compile; now generate the code to call them.