From patchwork Fri Aug 18 02:30:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 135969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp1112707vqi; Thu, 17 Aug 2023 19:31:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIkkC7gsaG9YXA+zOSJEqqdgBWoEylx1YAooLAfEQ7FAOrXyCeUpTx+j/jZJDTqqCYi4lX X-Received: by 2002:a19:5042:0:b0:4fe:cc0:340 with SMTP id z2-20020a195042000000b004fe0cc00340mr609043lfj.60.1692325899458; Thu, 17 Aug 2023 19:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692325899; cv=none; d=google.com; s=arc-20160816; b=Mpmz/URaFdHC5Zty68ZLcV+Z8YCdvBk2Hj/0M3Bx88KxcaHevdNc+e1owYX1/SdiUy q7eZuQ17FDxYFqdvmgubMrsqSbkzxIkTd0/45vzoDbwqYi84/EhattF8uodTdq+bnR81 HGFL4UqcSSDxgVmUWi3l75vCu/fwK4Conjg7gj3eYWWYAtfYjjTUNhU3YpgZkqJxRfJt gRyT6UMZ97rpl5KkK/WNfHbig84RrIIUiF/JNR6KkjxpS6iE5eApjJJK2716dRCQW60h STARNN4ZhPPrzoMgHHGoaBfvvb6rHdctH3bTu3k3GD6BsTsOcpYfM1QiTkPrMNYK+q3m dQyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=Bs/g1nf2mDEODZiXz9y/IouzhquygDRsRZrqoXrnOgg=; fh=eYeNc2DX/AbqlhfK7aevJFT7Y56Kb9iqVPUYC9106oI=; b=YPPEzBSDenOozmXDzMk2yJe5G8DmUJQeHboAanmlnufF7I0S3y18z7eCObjjbm1Jk3 +zpiZ7HmVxV5xvnDXvcD1/40IdBWuvOY/eTHJQou98wgJ9Pd89n+6R/ZXd6vRtRCs5mg ImF4LR6A4fvkHw1XpevWcjzxiZ2LDmIrLaeuJzkrdPa76MN+G4z/wrnK+qEhXxrKHeKw WyZllYp6beeHEqbR3GVBWgWVWirGrKLn1iaRHeu/ZeX8I3ftqwi7DkQKw4F+hUIvHkAL 7APANtiQSAoRdkXN6WDUmftuPpuJ8sbZqhRZLPd4j5rVamZJttnbJrpCqpkg7pMmqtmb PNxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HO41GBr7; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ca23-20020aa7cd77000000b00525667e5154si575929edb.258.2023.08.17.19.31.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 19:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HO41GBr7; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3A9943853D3D for ; Fri, 18 Aug 2023 02:31:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A9943853D3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692325898; bh=Bs/g1nf2mDEODZiXz9y/IouzhquygDRsRZrqoXrnOgg=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=HO41GBr7tnH4pvH2VEvM4PWTF/yx+ybEMoXnKcFFMjfX4EKjxHzkIyo2THswlDKM2 5NwOXCEL5J77LIDsdqcnOdyKNdv5gNznMFFI9/Aso8jtRvvRdXc3Jgsbjsesl56s8I Z4xxGzJpXqJnnPE5+cWloefwv34TBCIUP63QRxb0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by sourceware.org (Postfix) with ESMTPS id A0E0F3853D11 for ; Fri, 18 Aug 2023 02:30:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0E0F3853D11 Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1c8c44053e8so266555fac.1 for ; Thu, 17 Aug 2023 19:30:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692325853; x=1692930653; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Bs/g1nf2mDEODZiXz9y/IouzhquygDRsRZrqoXrnOgg=; b=EjrvM5fMomJxFlyRl4VYiM6OAG8oVMJwEThIu4IT0FfXoECZDA5fEkRNIyWXqD9dO2 9n6FDGkl6ZudiowQS5DzbKkJ3Su2K3BTfashkLT7iSJegL1ij0/haf0Mt2AXsguFYuwG 9867MlBcKjmn0Hqwz7oFN5QHy38+FptLjRG0der2YHJLabwWgQXpkiyIoS9t9CMVfFJ1 8bjkCNsfhCBXCp6mkJOhS93pvxr1lCy/OMgWcpVxu+SoML/eflAEZiZ2dVdwS4qnkbEm J6WoHe7IP3ah2Njr0YWOC/3jCUwlgsBA/SdcXaMxyCncL+PtND0ohplnD5hRfqphsO7j 1XhQ== X-Gm-Message-State: AOJu0YxcT0bvw1bJQVUCyiErPWX2InlmVYsXs0OKcpaCzKfnoUUmwMyJ 4UoeF+IeItFvfDqmYWG6rSf/Hii0x/xhnxVsA/k= X-Received: by 2002:a05:6871:520b:b0:1bf:cec2:6aff with SMTP id ht11-20020a056871520b00b001bfcec26affmr3292182oac.5.1692325853441; Thu, 17 Aug 2023 19:30:53 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:7043:d206:cd2a:51ba]) by smtp.gmail.com with ESMTPSA id ds5-20020a0568705b0500b001c50fb56845sm556127oab.16.2023.08.17.19.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 19:30:52 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Feng , David Malcolm Subject: [PATCH] testsuite: Improve test in dg-require-python-h Date: Thu, 17 Aug 2023 23:30:50 -0300 Message-ID: <20230818023050.98368-1-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Thiago Jung Bauermann via Gcc-patches From: Thiago Jung Bauermann Reply-To: Thiago Jung Bauermann Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774532322667476695 X-GMAIL-MSGID: 1774532322667476695 If GCC is tested with a sysroot which doesn't contain a Python installation (e.g., with a command such as "make check-gcc-c FLAGS_UNDER_TEST="--sysroot=/some/path"), but there's a python3-config in $PATH, then the testsuite will pick up the host's Python.h which can't actually be used: Executing on host: python3-config --includes (timeout = 300) spawn -ignore SIGHUP python3-config --includes -I/usr/include/python3.10 -I/usr/include/python3.10 Executing on host: /some/sysroot/bin/aarch64-unknown-linux-gnu-gcc --sysroot=/some/sysroot/libc -Wl,-dynamic-linker=/some/sysroot/libc/lib/ld-linux-aarch64.so.1 -Wl,-rpath=/some/sysroot/libc/lib /some/src/gcc.git/gcc/testsuite/gcc.dg/plugin/cpython-plugin-test-2.c -fdiagnostics-plain-output -fplugin=./analyzer_cpython_plugin.so -fanalyzer -I/usr/include/python3.10 -I/usr/include/python3.10 -S -o cpython-plugin-test-2.s (timeout = 600) spawn -ignore SIGHUP /some/sysroot/bin/aarch64-unknown-linux-gnu-gcc --sysroot=/some/sysroot/libc -Wl,-dynamic-linker=/some/sysroot/libc/lib/ld-linux-aarch64.so.1 -Wl,-rpath=/some/sysroot/libc/lib /some/src/gcc.git/gcc/testsuite/gcc.dg/plugin/cpython-plugin-test-2.c -fdiagnostics-plain-output -fplugin=./analyzer_cpython_plugin.so -fanalyzer -I/usr/include/python3.10 -I/usr/include/python3.10 -S -o cpython-plugin-test-2.s In file included from /usr/include/python3.10/Python.h:8, from /some/src/gcc.git/gcc/testsuite/gcc.dg/plugin/cpython-plugin-test-2.c:8: /usr/include/python3.10/pyconfig.h:9:12: fatal error: aarch64-linux-gnu/python3.10/pyconfig.h: No such file or directory compilation terminated. compiler exited with status 1 This problem causes these testsuite failures: FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 17) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 18) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 21) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 31) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 32) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 35) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 45) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 55) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 63) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 66) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 68) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for warnings, line 69) FAIL: gcc.dg/plugin/cpython-plugin-test-2.c -fplugin=./analyzer_cpython_plugin.so (test for excess errors) Excess errors: /usr/include/python3.10/pyconfig.h:9:12: fatal error: aarch64-linux-gnu/python3.10/pyconfig.h: No such file or directory compilation terminated. So try to compile a test file so that the testcase can be marked as unsupported instead. gcc/testsuite/ChangeLog: * gcc/testsuite/lib/target-supports.exp (dg-require-python-h): Test whether Python.h can really be used. --- gcc/testsuite/lib/target-supports.exp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) base-commit: 1eb2433ff9e85008a289db03ff7eb802d51c42a8 diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 92b6f69730e9..5b5f86551844 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -12570,11 +12570,21 @@ proc dg-require-python-h { args } { verbose "ENTER dg-require-python-h" 2 + set supported 0 set result [remote_exec host "python3-config --includes"] set status [lindex $result 0] if { $status == 0 } { - set python_flags [lindex $result 1] - } else { + # Remove trailing newline from python3-config output. + set python_flags [string trim [lindex $result 1]] + if [check_no_compiler_messages python_h assembly { + #include + int main (void) { return 0; } + } $python_flags] { + set supported 1 + } + } + + if { $supported == 0 } { verbose "Python.h not supported" 2 upvar dg-do-what dg-do-what set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]