about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2020-04-01 15:33:00 -0400
committerDJ Delorie <dj@redhat.com>2020-10-05 17:16:03 -0400
commit78e09591a59fb4cb634cde28089924383151fcfe (patch)
tree644fa7b30f447e56f5daccb65d768b803ce94a14 /scripts
parent19302b27bdacfe87e861ff46fc0fbad60dd6602d (diff)
downloadglibc-78e09591a59fb4cb634cde28089924383151fcfe.tar.gz
glibc-78e09591a59fb4cb634cde28089924383151fcfe.tar.xz
glibc-78e09591a59fb4cb634cde28089924383151fcfe.zip
Optimize scripts/merge-test-results.sh
The inner loop is called thousands of times per "make check" even
if there's otherwise nothing to do.  Avoid calling /bin/head all
those times when a builtin will do.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/merge-test-results.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/merge-test-results.sh b/scripts/merge-test-results.sh
index 573a44d8cf..1e236db4a7 100755
--- a/scripts/merge-test-results.sh
+++ b/scripts/merge-test-results.sh
@@ -35,7 +35,12 @@ case $type in
     subdir=${subdir:+$subdir/}
     for t in "$@"; do
       if [ -s "$objpfx$t.test-result" ]; then
-	head -n1 "$objpfx$t.test-result"
+	# This loop is called thousands of times even when there's
+	# nothing to do.  Avoid using non-built-in commands (like
+	# /bin/head) where possible.  We assume "echo" is typically a
+	# built-in.
+	IFS= read -r line < "$objpfx$t.test-result"
+	echo "$line"
       else
 	echo "UNRESOLVED: $subdir$t"
       fi