bug-dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-dejagnu] dg-test doesn't support nested invocations


From: Rainer Orth
Subject: [Bug-dejagnu] dg-test doesn't support nested invocations
Date: Fri, 04 Feb 2011 12:16:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v)

While developing a testsuite for the copy of boehm-gc inside the GCC
tree

        [testsuite, build] Convert boehm-gc testsuite to DejaGnu (PR 
boehm-gc/11412)
        http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00244.html

I noticed that you cannot do nested calls to dg-test.  My use case is
like this:

        ${tool}-dg-runtest -> dg-test -> dg-add-shlib -> dg-test

I'm including a complete example.  With dejagnu 1.4.4, it fails like
this:

> runtest --tool nest
WARNING: Couldn't find the global config file.
Test Run By ro on Fri Feb  4 12:09:21 2011
Native configuration is i386-pc-solaris2.11

                === nest tests ===

Schedule of variations:
    unix

Running target unix
Using /vol/gcc/share/dejagnu/baseboards/unix.exp as board description file for 
target.
Using /vol/gcc/share/dejagnu/config/unix.exp as generic interface file for 
target.
WARNING: Couldn't find tool config file for unix, using default.
Running ./nest.dg/dg.exp ...
ERROR: tcl error sourcing ./nest.dg/dg.exp.
ERROR: can't rename "dg-save-unknown": command doesn't exist
    while executing
"rename dg-save-unknown unknown"
    (procedure "dg-test" line 96)
    invoked from within
"dg-test $testcase $flags ${default-extra-flags}"
    (procedure "dg-runtest" line 10)
    invoked from within
"dg-runtest $srcdir/$subdir/nest.c "" """
    (file "./nest.dg/dg.exp" line 4)
    invoked from within
"source ./nest.dg/dg.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source ./nest.dg/dg.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""

                === nest Summary ===

# of expected passes            1

The following patch lets it pass:

2011-02-04  Rainer Orth  <address@hidden>

        * lib/dg.exp (dg-test): Support nested calls.

--- dg.exp.dist 2009-08-25 11:15:32.000000000 +0200
+++ dg.exp      2011-01-09 23:05:07.208816846 +0100
@@ -675,10 +675,11 @@
 
     # Define our own "special function" `unknown' so we catch spelling errors.
     # But first rename the existing one so we can restore it afterwards.
-    catch {rename dg-save-unknown ""}
-    rename unknown dg-save-unknown
-    proc unknown { args } {
-       return -code error "unknown dg option: $args"
+    if { [info procs dg-save-unknown] == [list] } {
+        rename unknown dg-save-unknown
+        proc unknown { args } {
+           return -code error "unknown dg option: $args"
+        }
     }
 
     set tmp [dg-get-options $prog]
@@ -702,8 +703,10 @@
     }
 
     # Restore normal error handling.
-    rename unknown ""
-    rename dg-save-unknown unknown
+    if { [info procs dg-save-unknown] != [list] } {
+        rename unknown ""
+        rename dg-save-unknown unknown
+    }
 
     # If we're not supposed to try this test on this target, we're done.
     if { [lindex ${dg-do-what} 1] == "N" } {


        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


Attachment: nested-dg-test.tar.bz2
Description: testcase for nested dg-test invocation


reply via email to

[Prev in Thread] Current Thread [Next in Thread]