Blame SOURCES/gdb-rhbz1491128-batch-mode-exit-status-2of2.patch

7bc85d
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
7bc85d
From: Gary Benson <gbenson@redhat.com>
7bc85d
Date: Mon, 3 Sep 2018 16:14:55 +0100
7bc85d
Subject: gdb-rhbz1491128-batch-mode-exit-status-2of2.patch
7bc85d
7bc85d
;; Fix for 'gdb in batch mode always exit with status 0' (Gary Benson)
7bc85d
;; RHBZ #1491128
7bc85d
7bc85d
Fix batch exit status test failure on Fedora 28
7bc85d
7bc85d
This commit adds calls to remote_close and clear_gdb_spawn_id to
7bc85d
gdb.base/batch-exit-status.exp, fixing failures reported by buildbot
7bc85d
on Fedora 28 where gdb_spawn_id not being reset by the previous test
7bc85d
caused default_gdb_spawn to return without spawning.
7bc85d
7bc85d
This commit also changes the test to use detect GDB's exit using
7bc85d
gdb_test_multiple expecting 'eof', rather than using 'wait -i' alone.
7bc85d
This means the testcase won't hang forever on failure as fixed in
7bc85d
gdb.base/quit.exp by commit 15763a09d4ae ("Fix 'gdb.base/quit.exp
7bc85d
hangs forever' if the test fails").
7bc85d
7bc85d
gdb/testsuite/ChangeLog:
7bc85d
7bc85d
	* gdb.base/batch-exit-status.exp: Use gdb_test_multiple and expect
7bc85d
	'eof' before 'wait -i'.  Use remote_close and clear_gdb_spawn_id.
7bc85d
7bc85d
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
7bc85d
--- a/gdb/testsuite/ChangeLog
7bc85d
+++ b/gdb/testsuite/ChangeLog
7bc85d
@@ -1,3 +1,8 @@
7bc85d
+2018-09-04  Gary Benson <gbenson@redhat.com>
7bc85d
+
7bc85d
+	* gdb.base/batch-exit-status.exp: Use gdb_test_multiple and expect
7bc85d
+	'eof' before 'wait -i'.  Use remote_close and clear_gdb_spawn_id.
7bc85d
+
7bc85d
 2018-08-16  Gary Benson <gbenson@redhat.com>
7bc85d
 
7bc85d
 	PR gdb/13000:
7bc85d
diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp
7bc85d
--- a/gdb/testsuite/gdb.base/batch-exit-status.exp
7bc85d
+++ b/gdb/testsuite/gdb.base/batch-exit-status.exp
7bc85d
@@ -29,11 +29,18 @@ proc _test_exit_status {expect_status cmdline_opts} {
7bc85d
 	return
7bc85d
     }
7bc85d
 
7bc85d
-    set result [wait -i $gdb_spawn_id]
7bc85d
-    verbose $result
7bc85d
-    gdb_assert { [lindex $result 2] == 0 }
7bc85d
-    set actual_status [lindex $result 3]
7bc85d
-    gdb_assert { $actual_status == $expect_status }
7bc85d
+    gdb_test_multiple "" "run til exit" {
7bc85d
+	eof {
7bc85d
+	    set result [wait -i $gdb_spawn_id]
7bc85d
+	    verbose $result
7bc85d
+
7bc85d
+	    gdb_assert { [lindex $result 2] == 0 }
7bc85d
+	    gdb_assert { [lindex $result 3] == $expect_status }
7bc85d
+
7bc85d
+	    remote_close host
7bc85d
+	    clear_gdb_spawn_id
7bc85d
+	}
7bc85d
+    }
7bc85d
 }
7bc85d
 
7bc85d
 proc test_exit_status {expect_status cmdline_opts} {