From patchwork Tue Dec 9 20:44:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 419248 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 9FAE614009B for ; Wed, 10 Dec 2014 07:49:25 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:date:content-type:mime-version; q= dns; s=default; b=A4rzZDOCxBoP8Rmn7IYpk8m2Bt2ZtuhPWXf4BQADZx6dCU tUFbkP4LZqK1b1bARHmwOrfIcdJ8b/zdTtVfMrAa22m7GA/2t6wC6MNKJhiW2iuA ZMkbcsBkj83UeB29DOf7LcdO9GzuSgeJS3aTxhuDduMgTUZPx4gL6PMvppGtE= 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 :message-id:subject:from:to:date:content-type:mime-version; s= default; bh=gt03DIb/0uZ47sycZRK4XRg/Ei8=; b=tIfzVyA+VgRbyuOzZTJu AVOwdUchjP72RGJuWa8z6VW+hSzHq+N/oZyroBpXlGETseDGI2LUNO2efP7IXMjm eVI4a4UEO5pvEQb2ztgYKLy1c1l8xUGi24JjNDTVoKkrLhT7PXInlZXl3pjxASXg wayg5udZkzU7ynkc6/tOgZs= Received: (qmail 26432 invoked by alias); 9 Dec 2014 20:49:17 -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 26412 invoked by uid 89); 9 Dec 2014 20:49:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.0 required=5.0 tests=AWL, BAYES_00, BODY_8BITS, GARBLED_BODY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 09 Dec 2014 20:49:15 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB9KnDVN020069 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 9 Dec 2014 15:49:13 -0500 Received: from [10.3.224.64] (vpn-224-64.phx2.redhat.com [10.3.224.64]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB9KnCZM007348; Tue, 9 Dec 2014 15:49:13 -0500 Message-ID: <1418157873.3400.10.camel@surprise> Subject: [PATCH, commmited] PR jit/63854: Document how to run the jit testsuite under valgrind From: David Malcolm To: "gcc-patches@gcc.gnu.org" , jit@gcc.gnu.org Date: Tue, 09 Dec 2014 15:44:33 -0500 Mime-Version: 1.0 X-IsSubscribed: yes Committed to trunk as r218538. Index: gcc/jit/ChangeLog =================================================================== --- gcc/jit/ChangeLog (revision 218537) +++ gcc/jit/ChangeLog (revision 218538) @@ -1,5 +1,12 @@ 2014-12-09 David Malcolm + PR jit/63854 + * docs/internals/index.rst (Running under valgrind): New + subsection. + (docs/_build/texinfo/libgccjit.texi): Regenerate. + +2014-12-09 David Malcolm + PR jit/64206 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o. * jit-common.h (gcc::jit::tempdir): New forward decl. Index: gcc/jit/docs/internals/index.rst =================================================================== --- gcc/jit/docs/internals/index.rst (revision 218537) +++ gcc/jit/docs/internals/index.rst (revision 218538) @@ -118,6 +118,51 @@ gdb --args \ testsuite/jit/test-factorial.exe +Running under valgrind +********************** + +The jit testsuite detects if 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 +`memcheck `_ +tool with +`--leak-check=full +`_. + +It automatically parses the output from valgrind, injecting XFAIL results if +any issues are found, or PASS results if the output is clean. The output +is saved to ``TESTNAME.exe.valgrind.txt``. + +For example, the following invocation verbosely runs the testcase +``test-sum-of-squares.c`` under valgrind, showing an issue: + +.. code-block:: console + + $ RUN_UNDER_VALGRIND= \ + make check-jit \ + RUNTESTFLAGS="-v -v -v jit.exp=test-sum-of-squares.c" + + (...verbose log contains detailed valgrind errors, if any...) + + === jit Summary === + + # of expected passes 28 + # of expected failures 2 + + $ less testsuite/jit/jit.sum + (...other results...) + XFAIL: jit.dg/test-sum-of-squares.c: test-sum-of-squares.exe.valgrind.txt: definitely lost: 8 bytes in 1 blocks + XFAIL: jit.dg/test-sum-of-squares.c: test-sum-of-squares.exe.valgrind.txt: unsuppressed errors: 1 + (...other results...) + + $ less testsuite/jit/test-sum-of-squares.exe.valgrind.txt + (...shows full valgrind report for this test case...) + +When running under valgrind, it's best to have configured gcc with +:option:`--enable-valgrind-annotations`, which automatically suppresses +various known false positives. + Environment variables --------------------- When running client code against a locally-built libgccjit, three Index: gcc/jit/docs/_build/texinfo/libgccjit.texi =================================================================== --- gcc/jit/docs/_build/texinfo/libgccjit.texi (revision 218537) +++ gcc/jit/docs/_build/texinfo/libgccjit.texi (revision 218538) @@ -197,6 +197,10 @@ * Environment variables:: * Overview of code structure:: +Running the test suite + +* Running under valgrind:: + @end detailmenu @end menu @@ -6548,8 +6552,61 @@ @noindent +@menu +* Running under valgrind:: + +@end menu + +@node Running under valgrind,,,Running the test suite +@anchor{internals/index running-under-valgrind}@anchor{c9} +@subsection Running under valgrind + + +The jit testsuite detects if RUN_UNDER_VALGRIND is present in the +environment (with any value). If it is present, it runs the test client +code under valgrind@footnote{http://valgrind.org}, +specifcally, the default +memcheck@footnote{http://valgrind.org/docs/manual/mc-manual.html} +tool with +--leak-check=full@footnote{http://valgrind.org/docs/manual/mc-manual.html#opt.leak-check}. + +It automatically parses the output from valgrind, injecting XFAIL results if +any issues are found, or PASS results if the output is clean. The output +is saved to @code{TESTNAME.exe.valgrind.txt}. + +For example, the following invocation verbosely runs the testcase +@code{test-sum-of-squares.c} under valgrind, showing an issue: + +@example +$ RUN_UNDER_VALGRIND= \ + make check-jit \ + RUNTESTFLAGS="-v -v -v jit.exp=test-sum-of-squares.c" + +(...verbose log contains detailed valgrind errors, if any...) + + === jit Summary === + +# of expected passes 28 +# of expected failures 2 + +$ less testsuite/jit/jit.sum +(...other results...) +XFAIL: jit.dg/test-sum-of-squares.c: test-sum-of-squares.exe.valgrind.txt: definitely lost: 8 bytes in 1 blocks +XFAIL: jit.dg/test-sum-of-squares.c: test-sum-of-squares.exe.valgrind.txt: unsuppressed errors: 1 +(...other results...) + +$ less testsuite/jit/test-sum-of-squares.exe.valgrind.txt +(...shows full valgrind report for this test case...) +@end example + +@noindent + +When running under valgrind, it's best to have configured gcc with +@code{--enable-valgrind-annotations}, which automatically suppresses +various known false positives. + @node Environment variables,Overview of code structure,Running the test suite,Internals -@anchor{internals/index environment-variables}@anchor{c9} +@anchor{internals/index environment-variables}@anchor{ca} @section Environment variables @@ -6557,7 +6614,7 @@ environment variables need to be set up: @geindex environment variable; LD_LIBRARY_PATH -@anchor{internals/index envvar-LD_LIBRARY_PATH}@anchor{ca} +@anchor{internals/index envvar-LD_LIBRARY_PATH}@anchor{cb} @deffn {Environment Variable} LD_LIBRARY_PATH @quotation @@ -6579,7 +6636,7 @@ @end deffn @geindex environment variable; PATH -@anchor{internals/index envvar-PATH}@anchor{cb} +@anchor{internals/index envvar-PATH}@anchor{cc} @deffn {Environment Variable} PATH The library uses a driver executable for converting from .s assembler @@ -6598,7 +6655,7 @@ @end deffn @geindex environment variable; LIBRARY_PATH -@anchor{internals/index envvar-LIBRARY_PATH}@anchor{cc} +@anchor{internals/index envvar-LIBRARY_PATH}@anchor{cd} @deffn {Environment Variable} LIBRARY_PATH The driver executable invokes the linker, and the latter needs to locate @@ -6634,7 +6691,7 @@ @noindent @node Overview of code structure,,Environment variables,Internals -@anchor{internals/index overview-of-code-structure}@anchor{cd} +@anchor{internals/index overview-of-code-structure}@anchor{ce} @section Overview of code structure @@ -6733,11 +6790,11 @@ ──────────────────────────> . . . . │ start of recording::context::compile () . . │ . . - . . │ ACQUIRE MUTEX . - . . │ . . . . │ start of playback::context::compile () . . │ (create tempdir) . . . │ . . + . . │ ACQUIRE MUTEX . + . . │ . . . . V───────────────────────> toplev::main (for now) . . . . │ . . . . (various code) @@ -6791,6 +6848,8 @@ . . │ . . . . │ Load DSO (dlopen "fake.so") . . │ . . + . . │ RELEASE MUTEX . + . . │ . . . . │ end of playback::context::compile () . . │ . . . . │ playback::context dtor @@ -6800,8 +6859,6 @@ . . │ filesystem at this point) . . <── . . . . │ . . - . . │ RELEASE MUTEX . - . . │ . . . . │ end of recording::context::compile () <─────────────────────────── . . │ . . . . @@ -6905,7 +6962,7 @@ production yet. @node Indices and tables,Index,Internals,Top -@anchor{index indices-and-tables}@anchor{ce} +@anchor{index indices-and-tables}@anchor{cf} @unnumbered Indices and tables