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

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