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

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