From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33121 invoked by alias); 31 Oct 2017 20:43:36 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 32624 invoked by uid 89); 31 Oct 2017 20:43:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=handy, logs, **********************, realize X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 31 Oct 2017 20:43:35 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C914C057FA4; Tue, 31 Oct 2017 20:43:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9C914C057FA4 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dmalcolm@redhat.com Received: from c64.redhat.com (ovpn-112-33.phx2.redhat.com [10.3.112.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E13760C98; Tue, 31 Oct 2017 20:43:32 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Cc: David Malcolm Subject: [committed] jit: add a way to preserve testsuite executables Date: Sun, 01 Jan 2017 00:00:00 -0000 Message-Id: <1509482701-31510-1-git-send-email-dmalcolm@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 31 Oct 2017 20:43:33 +0000 (UTC) X-IsSubscribed: yes X-SW-Source: 2017-q4/txt/msg00003.txt.bz2 The jit documentation has instructions on running testsuite executables under the debugger, but I realize now that the executables were always being deleted after being run, and I've always been hacking up my jit.exp to prevent this, to allow for debugging them. This patch adds a PRESERVE_EXECUTABLES environment variable to jit.exp to provide a simple, documented way to do this. Committed to trunk as r254282. gcc/jit/ChangeLog: * docs/internals/index.rst (Running the test suite): Document PRESERVE_EXECUTABLES. (Running under valgrind): Add markup to RUN_UNDER_VALGRIND. * docs/_build/texinfo/libgccjit.texi: Regenerate. gcc/testsuite/ChangeLog: * jit.dg/jit.exp (jit-dg-test): If PRESERVE_EXECUTABLES is set in the environment, don't delete the generated executable. --- gcc/jit/docs/internals/index.rst | 10 +++++++--- gcc/testsuite/jit.dg/jit.exp | 9 +++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gcc/jit/docs/internals/index.rst b/gcc/jit/docs/internals/index.rst index cadf362..4ad7f61 100644 --- a/gcc/jit/docs/internals/index.rst +++ b/gcc/jit/docs/internals/index.rst @@ -103,7 +103,9 @@ and detailed logs in: jit/build/gcc/testsuite/jit/jit.log -The test executables can be seen as: +The test executables are normally deleted after each test is run. For +debugging, they can be preserved by setting :envvar:`PRESERVE_EXECUTABLES` +in the environment. If so, they can then be seen as: .. code-block:: console @@ -115,7 +117,9 @@ You can compile and run individual tests by passing "jit.exp=TESTNAME" to RUNTES .. code-block:: console - [gcc] $ make check-jit RUNTESTFLAGS="-v -v -v jit.exp=test-factorial.c" + [gcc] $ PRESERVE_EXECUTABLES= \ + make check-jit \ + RUNTESTFLAGS="-v -v -v jit.exp=test-factorial.c" and once a test has been compiled, you can debug it directly: @@ -130,7 +134,7 @@ and once a test has been compiled, you can debug it directly: Running under valgrind ********************** -The jit testsuite detects if RUN_UNDER_VALGRIND is present in the +The jit testsuite detects if :envvar:`RUN_UNDER_VALGRIND` is present in the environment (with any value). If it is present, it runs the test client code under `valgrind `_, specifcally, the default diff --git a/gcc/testsuite/jit.dg/jit.exp b/gcc/testsuite/jit.dg/jit.exp index 39e37c2..869d9f6 100644 --- a/gcc/testsuite/jit.dg/jit.exp +++ b/gcc/testsuite/jit.dg/jit.exp @@ -580,6 +580,15 @@ proc jit-dg-test { prog do_what extra_tool_flags } { verbose "$name is not meant to generate a reproducer" } + # Normally we would return $comp_output and $output_file to the + # caller, which would delete $output_file, the generated executable. + # If we need to debug, it's handy to be able to suppress this behavior, + # keeping the executable around. + set preserve_executables [info exists env(PRESERVE_EXECUTABLES)] + if $preserve_executables { + set output_file "" + } + return [list $comp_output $output_file] } -- 1.8.5.3