This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb.base/info-os.exp FAILs/ERRORs [Re: [commit] 'info os' additions]


On Sat, 12 May 2012 03:32:12 +0200, Stan Shebs wrote:
>     * gdb.base/info-os.exp: New file.
>     * gdb.base/info-os.c: New file.

With heavy parallelization it gives:

+ERROR: internal buffer is full.
+UNRESOLVED: gdb.base/info-os.exp: get process list
+ERROR: internal buffer is full.
+UNRESOLVED: gdb.base/info-os.exp: get process groups
+ERROR: internal buffer is full.
+UNRESOLVED: gdb.base/info-os.exp: get threads
+ERROR: internal buffer is full.
+UNRESOLVED: gdb.base/info-os.exp: get file descriptors
+ERROR: internal buffer is full.
+UNRESOLVED: gdb.base/info-os.exp: get internet-domain sockets

where the buffer overflows get fixed by the attached patch.  But even with that
patch it still produces:

info os semaphores^M
(gdb) FAIL: gdb.base/info-os.exp: get semaphores
info os msg^M
(gdb) FAIL: gdb.base/info-os.exp: get message queues
(gdb) info os shm^M
key        shmid      permissions size       creator command last op. command num attached user       group      creator user creator group last shmat() time last shmdt() time last shmctl() time ^M
3925       196608     666        4096       info-os    0          0          jkratoch   jkratoch   jkratoch   jkratoch                         Sat May 12 17:22:10 2012 ^M
(gdb) FAIL: gdb.base/info-os.exp: get shared-memory regions

as apparently the .c testfile creates constant resources and expects they are
free, therefore multiple runs clash.  There can be even multiple runs by
different users.  This is why for example gdbserver_start does:
    # Loop till we find a free port.
[...]
                    incr portnum

Could you fix this part?


Thanks,
Jan

gdb/testsuite/
2012-05-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix ERROR: internal buffer is full.
	* gdb.base/info-os.exp (expect_multiline): New function.
	(get process list, get process groups, get threads)
	(get file descriptors, get internet-domain sockets)
	(get shared-memory regions, get semaphores, get message queues): Use
	it for these tests.

diff --git a/gdb/testsuite/gdb.base/info-os.exp b/gdb/testsuite/gdb.base/info-os.exp
index e1f7224..5696402 100644
--- a/gdb/testsuite/gdb.base/info-os.exp
+++ b/gdb/testsuite/gdb.base/info-os.exp
@@ -90,15 +90,62 @@ gdb_test_multiple "print port" $test {
     }
 }
 
+# Act like gdb_test but prevent: +ERROR: internal buffer is full.
+
+proc expect_multiline { command expect test } {
+    global gdb_prompt
+
+    # Do not duplicate FAILs from gdb_test_multiple.
+    set pass 0
+    set fail 0
+    gdb_test_multiple $command $test {
+	-re "^$expect *\r\n" {
+	    pass $test
+	    set pass 1
+	    exp_continue
+	}
+	-re "^$gdb_prompt $" {
+	    if !$pass {
+		set fail 1
+	    }
+	    # Exit the loop.
+	}
+	-re "\r\n" {
+	    # Drop the buffer.
+	    exp_continue
+	}
+    }
+    if $fail {
+	fail $test
+    }
+}
+
 # Test output of the 'info os' commands against the expected results.
-gdb_test "info os processes" ".*pid +user +command +cores.*$inferior_pid +\\S+ +\\S*info-os +\[0-9\]+.*" "get process list"
-gdb_test "info os procgroups" ".*pgid +leader command +pid +command line.*$inferior_pid +info-os +$inferior_pid +\\S*info-os.*" "get process groups"
-gdb_test "info os threads" ".*pid +command +tid +core.*$inferior_pid +info-os +\\d+ +\\d+.*" "get threads"
-gdb_test "info os files" ".*pid +command +file descriptor +name.*$inferior_pid +info-os +\\d+ +/dev/null.*" "get file descriptors"
-gdb_test "info os sockets" ".*local address +local port +remote address +remote port +state +user +family +protocol.*0\\.0\\.0\\.0 +$port +0\\.0\\.0\\.0 +0 +LISTEN +\\S+ +INET +STREAM.*" "get internet-domain sockets"
-gdb_test "info os shm" ".*key +shmid +permissions +size +creator command +last op\\. command +num attached +user +group +creator user +creator group +last shmat\\(\\) time +last shmdt\\(\\) time +last shmctl\\(\\) time.*3925 +$shmid +666 +4096 +info-os +.*" "get shared-memory regions"
-gdb_test "info os semaphores" ".*key +semid +permissions +num semaphores +user +group +creator user +creator group +last semop\\(\\) time +last semctl\\(\\) time.*7428 +$semid +666 +1 +.*" "get semaphores"
-gdb_test "info os msg" ".*key +msqid +permissions +num used bytes +num messages +last msgsnd\\(\\) command +last msgrcv\\(\\) command +user +group +creator user +creator group +last msgsnd\\(\\) time +last msgrcv\\(\\) time +last msgctl\\(\\) time.*5294 +$msqid +666 +.*" "get message queues"
+
+#                                     pid            user  command      cores
+expect_multiline "info os processes" "$inferior_pid +\\S+ +\\S*info-os +\[0-9,\]+" "get process list"
+
+#                                      pgid           leader   pid            command line
+expect_multiline "info os procgroups" "$inferior_pid +info-os +$inferior_pid +\\S*info-os" "get process groups"
+
+#                                   pid            command  tid   core
+expect_multiline "info os threads" "$inferior_pid +info-os +\\d+ +\\d+" "get threads"
+
+#                                 pid            command  fd    name
+expect_multiline "info os files" "$inferior_pid +info-os +\\d+ +/dev/null" "get file descriptors"
+
+#                                   local address  l-port remote addr r-port state  user family protocol
+expect_multiline "info os sockets" "0\\.0\\.0\\.0 +$port +0\\.0\\.0\\.0 +0 +LISTEN +\\S+ +INET +STREAM" "get internet-domain sockets"
+
+#                               key   shmid   perm size creator command last op  command  num attached  user  group  creator user  creator group  last shmat() time  last shmdt() time  last shmctl() time
+expect_multiline "info os shm" "3925 +$shmid +666 +4096 +info-os .*" "get shared-memory regions"
+
+#                                      key   semid   perm num semaphores  user  group  creator user  creator group  last semop() time  last semctl() time
+expect_multiline "info os semaphores" "7428 +$semid +666 +1 .*" "get semaphores"
+
+#                               key   msqid   perm  num used bytes  num messages  last msgsnd() command  last msgrcv() command  user  group  creator user  creator group  last msgsnd() time  last msgrcv() time  last msgctl() time
+expect_multiline "info os msg" "5294 +$msqid +666 .*" "get message queues"
+
 
 # The SysV IPC primitives linger on after the creating process is killed
 # unless they are destroyed explicitly, so allow the test program to tidy


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]