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

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