From 71cd8e3a743046573744123777061b64881bf372 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sat, 4 Jul 2015 17:13:50 +0300 Subject: Imported Upstream version 8.24 --- tests/misc/sort-spinlock-abuse.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests/misc/sort-spinlock-abuse.sh') diff --git a/tests/misc/sort-spinlock-abuse.sh b/tests/misc/sort-spinlock-abuse.sh index 49ed920f..e81abf80 100755 --- a/tests/misc/sort-spinlock-abuse.sh +++ b/tests/misc/sort-spinlock-abuse.sh @@ -2,7 +2,7 @@ # trigger a bug that would make parallel sort use 100% of one or more # CPU while blocked on output. -# Copyright (C) 2010-2014 Free Software Foundation, Inc. +# Copyright (C) 2010-2015 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,13 +29,16 @@ very_expensive_ grep '^#define HAVE_PTHREAD_T 1' "$CONFIG_HEADER" > /dev/null || skip_ 'requires pthreads' +# Terminate any background processes +cleanup_() { kill $pid 2>/dev/null && wait $pid; } + seq 100000 > in || framework_failure_ mkfifo_or_skip_ fifo # Arrange for sort to require 8.0+ seconds of wall-clock time, # while actually using far less than 1 second of CPU time. (for i in $(seq 80); do read line; echo $i; sleep .1; done - cat > /dev/null) < fifo & + cat > /dev/null) < fifo & pid=$! # However, under heavy load, it can easily take more than # one second of CPU time, so set a permissive limit: -- cgit v1.2.3