From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id DF0773860765 for ; Fri, 18 Aug 2023 18:11:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF0773860765 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692382278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yot939hYRhcvQnV8STgwyFdvMX2sHAb8CcDm7OLGR/Q=; b=I+atze/9zey4cGBrp+0XV2U6K2w6FJJztsAMbhD2qhzZ+b5taz3yv6RC5ZgECyfipNjg77 YrSyb7AXlXSyw/1BLLjGRgIsrhmY64D+CYbyrBi+xRRojOcuXWdhYS7jJvI/SKvU0yP/QA AA+K7X9Qu5oLq512p+KxRHTKoKOhiVc= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-5jr8asA0O0WN-bBCwQysoQ-1; Fri, 18 Aug 2023 14:11:16 -0400 X-MC-Unique: 5jr8asA0O0WN-bBCwQysoQ-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-64977a67bcbso15789146d6.1 for ; Fri, 18 Aug 2023 11:11:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692382276; x=1692987076; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Yot939hYRhcvQnV8STgwyFdvMX2sHAb8CcDm7OLGR/Q=; b=cio/7y14YPAXMTO/iYRiS1+AGn7CuiP4CxLsmsmqUyYDTt+3eNyOzld0PxX/wImrLQ EAlbeZILLGmcfSIrEEq4iCKBC2Y5zElkZ1UaLqi8PS18pVyUB9Z509jhYBBQ4UufvuF1 tNlSyUBYCyRi1dU/LTYmZDIJ08tTmx/WQ1SyCRMND8KNTjRHO1ZIsey6OEh71n07H5K4 lodgCzibuvRf1K2ZAaj+auLcfzxYrLndHHVRRK8/JDUSsdMquFsBU7FOPgLwbvMVGHRX BrvcvAXFaSQ3wiqleuCf5+NEysvYobvzXbVXrF37XB8F6jPs4G0RLsZythzwuHUPyPod RnmA== X-Gm-Message-State: AOJu0YyzSsHO+we+WnslXGDYPCK2YVHxjAFOBm+RrGmtEJW8vEbKpjEN 4S15sMiROTJyt3C3vsFNSvHhOkbyzvKUER5vuXa+8+qbcXEiLV7fvwUUWuLTBNPMNWqoOve38bJ kUPlfIoDD7Ssk4cYgNQ== X-Received: by 2002:a0c:b20b:0:b0:649:dc3e:d75d with SMTP id x11-20020a0cb20b000000b00649dc3ed75dmr3853565qvd.15.1692382276222; Fri, 18 Aug 2023 11:11:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbMVlxSGft/Rx5RC3NkHtNrzyDAtv40DiiIHOh0QuTIWWUGG9P5L7+k0axOweJhzMgAO9+LA== X-Received: by 2002:a0c:b20b:0:b0:649:dc3e:d75d with SMTP id x11-20020a0cb20b000000b00649dc3ed75dmr3853545qvd.15.1692382275876; Fri, 18 Aug 2023 11:11:15 -0700 (PDT) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id a25-20020a0cb359000000b0063d2a70dff5sm856758qvf.72.2023.08.18.11.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Aug 2023 11:11:15 -0700 (PDT) Message-ID: Subject: Re: [PATCH] testsuite: Improve test in dg-require-python-h From: David Malcolm To: Thiago Jung Bauermann , gcc-patches@gcc.gnu.org Cc: Eric Feng Date: Fri, 18 Aug 2023 14:11:14 -0400 In-Reply-To: <20230818023050.98368-1-thiago.bauermann@linaro.org> References: <20230818023050.98368-1-thiago.bauermann@linaro.org> User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: On Thu, 2023-08-17 at 23:30 -0300, Thiago Jung Bauermann wrote: > 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=3D"--sysroot=3D/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: >=20 > Executing on host: python3-config --includes=C2=A0=C2=A0=C2=A0 (timeout = =3D 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=3D/some/sysroot/libc -Wl,-dynamic- > linker=3D/some/sysroot/libc/lib/ld-linux-aarch64.so.1 -Wl,- > rpath=3D/some/sysroot/libc/lib=C2=A0 > /some/src/gcc.git/gcc/testsuite/gcc.dg/plugin/cpython-plugin-test- > 2.c=C2=A0=C2=A0=C2=A0 -fdiagnostics-plain-output=C2=A0 - > fplugin=3D./analyzer_cpython_plugin.so -fanalyzer - > I/usr/include/python3.10 -I/usr/include/python3.10 -S -o cpython- > plugin-test-2.s=C2=A0=C2=A0=C2=A0 (timeout =3D 600) > spawn -ignore SIGHUP /some/sysroot/bin/aarch64-unknown-linux-gnu-gcc > --sysroot=3D/some/sysroot/libc -Wl,-dynamic- > linker=3D/some/sysroot/libc/lib/ld-linux-aarch64.so.1 -Wl,- > rpath=3D/some/sysroot/libc/lib > /some/src/gcc.git/gcc/testsuite/gcc.dg/plugin/cpython-plugin-test-2.c > -fdiagnostics-plain-output -fplugin=3D./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, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 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 >=20 > This problem causes these testsuite failures: >=20 > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 17) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 18) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 21) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 31) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 32) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 35) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 45) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 55) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 63) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 66) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 68) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./analyzer_cpython_plugin.so=C2=A0 (test for warnings, line 69) > FAIL: gcc.dg/plugin/cpython-plugin-test-2.c - > fplugin=3D./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. >=20 > So try to compile a test file so that the testcase can be marked as > unsupported instead. >=20 > gcc/testsuite/ChangeLog: > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* gcc/testsuite/lib/targe= t-supports.exp (dg-require-python- > h): Test > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 whether Python.h can really be= used. > --- > =C2=A0gcc/testsuite/lib/target-supports.exp | 14 ++++++++++++-- > =C2=A01 file changed, 12 insertions(+), 2 deletions(-) >=20 > 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 } { > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0 verbose "ENTER dg-require-python-h" 2 > =C2=A0 > +=C2=A0=C2=A0=C2=A0 set supported 0 > =C2=A0=C2=A0=C2=A0=C2=A0 set result [remote_exec host "python3-config --i= ncludes"] > =C2=A0=C2=A0=C2=A0=C2=A0 set status [lindex $result 0] > =C2=A0=C2=A0=C2=A0=C2=A0 if { $status =3D=3D 0 } { > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 set python_flags [lindex $res= ult 1] > -=C2=A0=C2=A0=C2=A0 } else { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Remove trailing newline from= python3-config output. > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0set python_flags [string trim = [lindex $result 1]] > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if [check_no_compiler_messages= python_h assembly { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #include > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int main (v= oid) { return 0; } > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} $python_flags] { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 set support= ed 1 > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > +=C2=A0=C2=A0=C2=A0 } > + > +=C2=A0=C2=A0=C2=A0 if { $supported =3D=3D 0 } { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0verbose "Python.h not sup= ported" 2 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0upvar dg-do-what dg-do-wh= at > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0set dg-do-what [list [lin= dex ${dg-do-what} 0] "N" "P"] >=20 > base-commit: 1eb2433ff9e85008a289db03ff7eb802d51c42a8 Thanks; patch looks OK to me Dave