diff --git a/gdb/testsuite/gdb.base/info-os.exp b/gdb/testsuite/gdb.base/info-os.exp
index b17a7842d5f..14bbbd95a07 100644
--- a/gdb/testsuite/gdb.base/info-os.exp
+++ b/gdb/testsuite/gdb.base/info-os.exp
@@ -125,17 +125,16 @@ proc expect_multiline { command expect test } {
     global gdb_prompt
 
     # Do not duplicate FAILs from gdb_test_multiple.
-    set pass 0
-    set fail 0
+    set found 0
+    set ok 0
     gdb_test_multiple $command $test {
 	-re "^$expect *\r\n" {
-	    pass $test
-	    set pass 1
+	    set found 1
 	    exp_continue
 	}
 	-re "^$gdb_prompt $" {
-	    if !$pass {
-		set fail 1
+	    if $found {
+		set ok 1
 	    }
 	    # Exit the loop.
 	}
@@ -144,9 +143,7 @@ proc expect_multiline { command expect test } {
 	    exp_continue
 	}
     }
-    if $fail {
-	fail $test
-    }
+    gdb_assert { $ok } $test
 }
 
 # Test output of the 'info os' commands against the expected results.