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]

Re: [PATCH 2/4] introduce parallel mode


On 07/18/2013 09:36 PM, Tom Tromey wrote:
> Good idea:)
> 
> It is just printed to the stdout of runtest.  That's because we just
> invoke inotifywait without redirections.  I suppose if we have the file
> descriptor of the log file available, we could send the output to the
> log.

Probably, we can send the output to the log, for example
inotify_[pid].log, and check whether there is something written into
the log in the test somewhere.  If there is, emit a FAIL, which would
be more attractive, like:

Running ../../../../git/gdb/testsuite/gdb.server/file-transfer.exp ...
FAIL: gdb.server/file-transfer.exp: Files are created in the wrong place: ./ CREATE down-server
./ CREATE up-server
./ DELETE down-server
./ DELETE up-server
./ CREATE down-server
./ CREATE up-server
./ DELETE down-server
./ DELETE up-server
Running ../../../../git/gdb/testsuite/gdb.server/no-thread-db.exp ...

The patch below does what I described here.
> 
> Here's a case where the test suite still makes a file outside the
> allowed directories:
> 
> barimba. runtest GDB_INOTIFY=yes GDB_PARALLEL=yes --directory=gdb.server
> [...]
> Running ../../../archer/gdb/testsuite/gdb.server/ext-run.exp ...
> Running ../../../archer/gdb/testsuite/gdb.server/file-transfer.exp ...
> ./ CREATE down-server
> ./ CREATE up-server
> ./ DELETE down-server
> ./ DELETE up-server
> ./ CREATE down-server
> ./ CREATE up-server
> ./ DELETE down-server
> ./ DELETE up-server
> Running ../../../archer/gdb/testsuite/gdb.server/no-thread-db.exp ...
> Running ../../../archer/gdb/testsuite/gdb.server/server-exec-info.exp ...

It is quite clear to me now.  Thanks.

-- 
Yao (éå)

	* lib/gdb.exp (default_gdb_version): Remove the log of
	inotify.
	(default_gdb_exit): Check inotify log, emit fail if something
	is written in it.  Clear the log.
---
 gdb/testsuite/lib/gdb.exp |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index fd37a81..aeded5b 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -116,6 +116,7 @@ proc default_gdb_version {} {
 
     if {[info exists inotify_pid]} {
 	exec kill $inotify_pid
+	file delete inotify_[pid].log
     }
 
     set output [remote_exec host "$GDB $INTERNAL_GDBFLAGS --version"]
@@ -1277,6 +1278,24 @@ proc default_gdb_exit {} {
 	remote_close host
     }
     unset gdb_spawn_id
+
+    if {[file exists inotify_[pid].log]} {
+	set fd [open inotify_[pid].log]
+	set data [read -nonewline $fd]
+
+	# Check something is written into the log.
+	if [string compare $data ""] then {
+	    fail "Files are created in the wrong place: $data"
+	}
+	close $fd
+
+	# Clear inotify log.
+	if [string compare $data ""] then {
+	    set fd [open inotify_[pid].log w]
+	    puts $fd ""
+	    close $fd
+	}
+    }
 }
 
 # Load a file into the debugger.
@@ -4272,7 +4291,7 @@ if {[info exists GDB_PARALLEL]} {
 	set exclusion_re ([join $exclusions |])
 
 	set inotify_pid [exec inotifywait -r -m -e move,create,delete . \
-			     --exclude $exclusion_re &]
+			     --exclude $exclusion_re -o inotify_[pid].log &]
 	# Wait for the watches; hopefully this is long enough.
 	sleep 2
     }
-- 
1.7.7.6


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