From patchwork Sun May 28 19:29:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9752637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 55D20602F0 for ; Sun, 28 May 2017 19:29:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44D852018F for ; Sun, 28 May 2017 19:29:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39B8E201BD; Sun, 28 May 2017 19:29:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBF1D2018F for ; Sun, 28 May 2017 19:29:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750802AbdE1T3Q (ORCPT ); Sun, 28 May 2017 15:29:16 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34511 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750837AbdE1T3P (ORCPT ); Sun, 28 May 2017 15:29:15 -0400 Received: by mail-wm0-f66.google.com with SMTP id d127so12947138wmf.1 for ; Sun, 28 May 2017 12:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QaUAZj8PVIZOqt7T6VHhnrxF4MAFxmS2QZZzOoioKoU=; b=niV8ZStJFJdNnzDW/LRvrPyeDqm+sTVH+NGaB8cjHCGi+q+f9Sg0e6ornhIgOcQF0E XYSwUjNR90Xx0RSlLbDDPY1En0xfMKfV2E31x/9wMvPCPIinn3zyxv9gwZclywMJgEa1 TYqeoKDCdzPHVWPx/lgMCD0rlbOzGRIpcN2jQg8EputuPKYyKZogQpVDhg5ZD/NpJUDh V63gI0WlskGC/lnRDMeSVY/Sa5w/gS6wMWuO0r6Sh+Pxpz2wyJbGq60HTaYUUIQH/0rb h8Q8PARWFuTznLZbqAAxVms1W5Bs7J43/LjuMGG4ws5MQkrPrWgwj9EYa3xrltlawXgJ 8VdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QaUAZj8PVIZOqt7T6VHhnrxF4MAFxmS2QZZzOoioKoU=; b=HZYRAugifgI+lsmlXqZ3YvYWwOxILHtpDT/4n2RRqAfwTwDbKberInqmvfKeQM69Kt 37X0VuTl8wwALU3KTW7I3h6YtQPpv3ESxYbmgHGL8h53e7o6Y3azELqgan+RwAVJ9t5C 2TBlwAXn366R98BOzRze0Y3PHIdqJjKPHLpGmQiHNIvwT4FaaVp+Zv1N+MAqLSL72iLs HYhf1o1hsTTDDj8fDCQ3ad2niZJDYF0QWITFCxSIPaJ7/M6n9/QdWaHHANgFCWQMqASu UJiwK4oZsc31G+qdnLQFometRhKOF3Pegwal/9Alx1mFKYA4ixsIoqazMQ1UyuVJH2ng BUAw== X-Gm-Message-State: AODbwcB+SJ9W8k4HoPdTnudn386hQ0MffZwHzBos0iTryH7I4VxrTeQs V0tJOHNEj8l8uUlStkg= X-Received: by 10.80.153.43 with SMTP id k40mr10045358edb.63.1495999753977; Sun, 28 May 2017 12:29:13 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:840:6400:ec7b:61ba:4d3e:5951]) by smtp.gmail.com with ESMTPSA id k17sm3840297eda.61.2017.05.28.12.29.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 May 2017 12:29:13 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 3/6] testsuite: grep the output patterns only when needed Date: Sun, 28 May 2017 21:29:03 +0200 Message-Id: <20170528192906.1023-4-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170528192906.1023-1-luc.vanoostenryck@gmail.com> References: <20170528192906.1023-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For some testcase, it is checked if the output contains or not some given pattern, or we're checking the number of time a pattern is present in the output. This is done with grep and some glue. But for most testcases there is nothing to check and this grepping is just wasted CPU cycles. Fix this by using the already known tags to see if we need to do this grepping or not. This speedup the testsuite by another 15%. Signed-off-by: Luc Van Oostenryck --- validation/test-suite | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/validation/test-suite b/validation/test-suite index ce2ca454c..e33d97804 100755 --- a/validation/test-suite +++ b/validation/test-suite @@ -244,22 +244,27 @@ do_test() fi # verify the 'check-output-contains/excludes' tags - has_each_patterns "$file" 'check-output-contains' $file.output.got - if [ "$?" -ne "0" ]; then - error "Actual output doesn't contain some of the expected patterns." - test_failed=1 + if [ $check_output_contains -eq 1 ]; then + has_each_patterns "$file" 'check-output-contains' $file.output.got + if [ "$?" -ne "0" ]; then + error "Actual output doesn't contain some of the expected patterns." + test_failed=1 + fi fi - has_none_patterns "$file" 'check-output-excludes' $file.output.got - if [ "$?" -ne "0" ]; then - error "Actual output contains some patterns which are not expected." - test_failed=1 + if [ $check_output_excludes -eq 1 ]; then + has_none_patterns "$file" 'check-output-excludes' $file.output.got + if [ "$?" -ne "0" ]; then + error "Actual output contains some patterns which are not expected." + test_failed=1 + fi fi - - # verify the 'check-output-pattern-X-times' tags - nbr_patterns "$file" 'check-output-pattern' $file.output.got - if [ "$?" -ne "0" ]; then - error "Actual output doesn't contain the pattern the expected number." - test_failed=1 + if [ $check_output_pattern -eq 1 ]; then + # verify the 'check-output-pattern-X-times' tags + nbr_patterns "$file" 'check-output-pattern' $file.output.got + if [ "$?" -ne "0" ]; then + error "Actual output doesn't contain the pattern the expected number." + test_failed=1 + fi fi [ "$test_failed" -eq "$must_fail" ] || failed=1