libgo/testsuite: another fix for killing the sleep process
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 20 Aug 2015 17:10:45 +0000 (17:10 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 20 Aug 2015 17:10:45 +0000 (17:10 +0000)
    Avoid ps padding issues.  Make sure we locate and kill just the sleep
    process.

    Reviewed-on: https://go-review.googlesource.com/13634

From-SVN: r227037

gcc/go/gofrontend/MERGE
libgo/testsuite/gotest

index 10f8b043e06c6df211b35bd28551d3a8e65c96f9..b2f305b354cd28129422f182303bf36b3cf9d35d 100644 (file)
@@ -1,4 +1,4 @@
-448d30b696461a39870d1b8beb1195e411300bfd
+ec34cfb0b148ff461df12c8f5270a06e2f438b7c
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index b2ee3ec248dd20ae847da406c4c4195478b36acb..79097b86bc61dad2b82c5226bc29b5cdf319670c 100755 (executable)
@@ -504,6 +504,7 @@ xno)
        fi
        ${GL} *.o ${GOLIBS}
 
+       set +e
        if test "$bench" = ""; then
                if test "$trace" = "true"; then
                    echo ./a.out -test.short -test.timeout=${timeout}s "$@"
@@ -518,9 +519,11 @@ xno)
                wait $pid
                status=$?
                if ! test -f gotest-timeout; then
-                   out=`ps -o pid,ppid | grep " $alarmpid" | cut -f1 -d" "`
-                   if test "x$out" != "x"; then
-                       kill -9 $out
+                   sleeppid=`ps -o pid,ppid,cmd | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+                   kill $alarmpid
+                   wait $alarmpid
+                   if test "$sleeppid" != ""; then
+                       kill $sleeppid
                    fi
                fi
        else