From patchwork Sun May 28 19:29:04 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: 9752639 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 E58CD602F0 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 D4E822018F for ; Sun, 28 May 2017 19:29:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9CFB201BD; 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 7AB2B2018F for ; Sun, 28 May 2017 19:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750846AbdE1T3R (ORCPT ); Sun, 28 May 2017 15:29:17 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34831 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750844AbdE1T3Q (ORCPT ); Sun, 28 May 2017 15:29:16 -0400 Received: by mail-wm0-f65.google.com with SMTP id g15so12960481wmc.2 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=na+LaFxFbIRy0GCurPbT+OoMYhWmw4M3GHIP1fHk+lQ=; b=Kh3bQgOLnNldLQZFRMcaMiarD7tq8yMvrCbs5UJR36e7NrpNU0u4r9vajl4HYuygT3 GoMIsc9sO3OxsTx3BkAPVvg1asftqtxjeN8Mh/x1jnKEOL01XUg9QiLwo5ODg1KO4A9M CgTjlE79etkAsXNRQhhxHpsTGwanO3YT5wEqybeHp9CWgyjqlw4I0fBpg7QFYePkaMaO 9shKdDflddBC5+nTDo+i26VyA0VN3g8h0f+Aj16qSRtSZitnlV3/Gn6rQJOCLuSs/TOk WgPFwm04qTs2nJ8P8qaEpjXhh14II7F+vlFwWk08I8E4AayMgpEHKxrkCnEEi205F8gh aDDg== 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=na+LaFxFbIRy0GCurPbT+OoMYhWmw4M3GHIP1fHk+lQ=; b=JGV+JpKv8ZEdm9/DnbUgVwqflIg/jw7ubH7PR/iyyAVmnE3s47voQKqlHdBT8g+M1v YcwONKO16fFydVn1SAjr49SJPR4jnDPYcrtorT/wc1n96gPeuAnES5FSWFxoDnp7b8Xu h2PLYpKwJLb1tN9aUvu0Xc8YLHp72kpz7O80htTp+yVTZQ4I9bmt+8L2BAjRK2OwDk2/ O9V5fSdhYSejYT+tHX0dMzHBCYE2Src60b8rGi6vxILhXut+VrazXPDtIdNfJfBJSBuX NGQeQJjHCTfJKlzBYb1SpEBXYcxTLUg8He/ToWKXlZTugn1gWDrTUNJpfQcSdIHf43uq F79Q== X-Gm-Message-State: AODbwcC9qfqiJF+SUEnYKvGKApl+OgBAxh1RXxPAdN1LikmZWpeJI7qi AgiJgHUwTRiWCn04cYw= X-Received: by 10.80.158.131 with SMTP id a3mr10131857edf.169.1495999754977; Sun, 28 May 2017 12:29:14 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 May 2017 12:29:14 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 4/6] testsuite: use shell arithmetic instead of fork-execing expr Date: Sun, 28 May 2017 21:29:04 +0200 Message-Id: <20170528192906.1023-5-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 The tessuite use a few counters to keep track of things. These counters are incremented via the 'expr' command. But this command is not a shell builtin and need thus to be fork+execed which need more CPU ressources than using some builtin operation. Change this by doing all the arithmetic via the portable '$(( ... ))' shell builtin. This speedup the testsuite by another 10%. Signed-off-by: Luc Van Oostenryck --- validation/test-suite | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/validation/test-suite b/validation/test-suite index e33d97804..da9d88159 100755 --- a/validation/test-suite +++ b/validation/test-suite @@ -180,7 +180,7 @@ do_test() # (it has to have a check-name key in it) if [ "$check_name" = "" ]; then echo "warning: test '$file' unhandled" - unhandled_tests=`expr $unhandled_tests + 1` + unhandled_tests=$(($unhandled_tests + 1)) return 2 fi test_name="$check_name" @@ -196,7 +196,7 @@ do_test() base_cmd=`basename $1` for i in $disabled_cmds; do if [ "$i" = "$base_cmd" ] ; then - disabled_tests=`expr $disabled_tests + 1` + disabled_tests=$(($disabled_tests + 1)) echo " DISABLE $test_name ($file)" return 3 fi @@ -218,7 +218,7 @@ do_test() must_fail=$check_known_to_fail quiet=0 [ $must_fail -eq 1 ] && [ $V -eq 0 ] && quiet=1 - known_ko_tests=`expr $known_ko_tests + $must_fail` + known_ko_tests=$(($known_ko_tests + $must_fail)) for stream in output error; do eval ignore=\$check_${stream}_ignore @@ -279,9 +279,9 @@ do_test() fi if [ "$test_failed" -eq "1" ]; then - ko_tests=`expr $ko_tests + 1` + ko_tests=$(($ko_tests + 1)) else - ok_tests=`expr $ok_tests + 1` + ok_tests=$(($ok_tests + 1)) rm -f $file.{error,output}.{expected,got,diff} fi return $test_failed @@ -294,7 +294,7 @@ do_test_suite() done # prints some numbers - tests_nr=`expr $ok_tests + $ko_tests` + tests_nr=$(($ok_tests + $ko_tests)) echo -n "Out of $tests_nr tests, $ok_tests passed, $ko_tests failed" echo " ($known_ko_tests of them are known to fail)" if [ "$unhandled_tests" -ne "0" ]; then