From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 4/6] testsuite: use shell arithmetic instead of fork-execing expr
Date: Sun, 28 May 2017 21:29:04 +0200 [thread overview]
Message-ID: <20170528192906.1023-5-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170528192906.1023-1-luc.vanoostenryck@gmail.com>
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 <luc.vanoostenryck@gmail.com>
---
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
--
2.13.0
next prev parent reply other threads:[~2017-05-28 19:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-28 19:29 [PATCH 0/6] testsuite speedup Luc Van Oostenryck
2017-05-28 19:29 ` [PATCH 1/6] testsuite: get all tags in once Luc Van Oostenryck
2017-05-28 19:29 ` [PATCH 2/6] testsuite: grep the expected output only when needed Luc Van Oostenryck
2017-05-28 19:29 ` [PATCH 3/6] testsuite: grep the output patterns " Luc Van Oostenryck
2017-05-28 19:29 ` Luc Van Oostenryck [this message]
2017-05-28 19:29 ` [PATCH 5/6] testsuite: remove unneeded './' before commands Luc Van Oostenryck
2017-05-28 19:29 ` [PATCH 6/6] testsuite: avoid fork+execing basename Luc Van Oostenryck
2017-05-28 22:04 ` [PATCH 0/6] testsuite speedup Ramsay Jones
2017-05-28 22:39 ` Luc Van Oostenryck
2017-05-29 1:44 ` Ramsay Jones
2017-06-01 9:16 ` Christopher Li
2017-06-01 14:05 ` Luc Van Oostenryck
2017-06-02 7:29 ` Christopher Li
2017-06-02 10:57 ` Luc Van Oostenryck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170528192906.1023-5-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).