dejagnu
[Top][All Lists]
Advanced

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

Code and comments in runtest.exp that do not match


From: Jacob Bachmeyer
Subject: Code and comments in runtest.exp that do not match
Date: Tue, 20 Nov 2018 18:07:12 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.22) Gecko/20090807 MultiZilla/1.8.3.4e SeaMonkey/1.1.17 Mnenhy/0.7.6.0

While adding --{loc,glob}al_init options to runtest, I ran across this code:

= at line 865 in master:runtest.exp
   if { [load_file -- $env(DEJAGNU)] == 0 } {
        # It may seem odd to only issue a warning if there isn't a global
        # config file, but issue an error if $DEJAGNU is erroneously defined.
        # Since $DEJAGNU is set there is *supposed* to be a global config file,
        # so the current behaviour seems reasonable.
        send_error "WARNING: global config file $env(DEJAGNU) not found.\n"
   }
=

The comment explains that an error will be raised if DEJAGNU is defined but $DEJAGNU cannot be loaded. The code then proceeds to merely report a warning and continue. Either the code should raise an error and exit or the comment should be removed.

Git traces the entire block back to 2001 when the code was imported into whatever became the DejaGnu Git repository. A search of the ancient ChangeLog for "DEJAGNU" turns up this:

= near line 3937 in ChangeLog-1992
Tue Mar 21 09:18:15 1995  Doug Evans  <address@hidden>

[...unrelated ChangeLog entries elided...]

        * runtest.exp: Treat $DEJAGNU as a global config file (which it is).
        Don't exit if there isn't a global config file, just warn the user.
        Error if $DEJAGNU is defined but file doesn't exist.
=

Which behavior is correct? The behavior described in the comments? What the current code actually does?

If the comments are correct, I can roll a fix into the --{loc,glob}al_init patch or write it separately. Which is preferred? (If the code is correct, the fix is obvious: delete the comment.)


-- Jacob



reply via email to

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