Ben Elliston wrote:
On Mon, Nov 12, 2018 at 06:17:13PM -0600, Jacob Bachmeyer wrote:
I have a few options:

(1)  Use a different long option name, perhaps "--base-directory".
(2)  Add a shell script shim for the testsuite to use that changes directory
and invokes "runtest".
(3)  Allow overriding the configfile name (default "site.exp") via
command-line option.
I vote for (3), even if it is only ever used by the testsuite.

On further examination, runtest.exp uses $configfile to load up to three different files: $base_dir/$configfile $objdir/$configfile $libdir/$configfile.

This suggests to me a useful distinction between "local" config files and "global" config files ($libdir/$configfile $DEJAGNU), and so leads to both --local-init and --global-init options, with --local-init influencing the search under $base_dir and $objdir and --global-init influencing the search under $libdir. These options can stand in for (2), since the parameter could include "/" and the loaded file can use Tcl's "cd" command, since init files are sourced before logs are opened. The use of the --local-init option is obvious, and --global-init is a simple extension from there with relevance for more complex testing labs.

There should be some way to inhibit loading local or global init files entirely; I suggest that setting --{local,global}-init to the empty string should do so. Per GNU conventions, this suggests that --no-local-init and --no-global-init should be aliases for --local-init='' and --global-init='' respectively.

The "configfile" variable is defined with a comment that it is local to runtext.exp, so removing it should not require a deprecation period.

The distinction is that "local" init files are specific to a testsuite, while "global" init files are specific to a site.

The config search order would become:
   (local)     $base_dir/$local_initfile -> $objdir/$local_initfile ->
   (global)    installed($global_initfile) -> $DEJAGNU -> $HOME/.dejagnurc

As a further step, should specifying an absolute path (matches {^/}) for --local-init or --global-init drop the default prefix? In this mode, the two local config files would be collapsed to the given local_initfile and the given global_initfile would be used as-is without prepending $libdir.

The DejaGnu testsuite would write $objdir/testsuite/runtest.all/site.exp and select it using "--local-init testsuite/runtest.all/site.exp"; that site.exp would in turn execute { cd ${objdir}/testsuite/runtest.all } or similar.

This is starting to look more useful than my original proposal.

-- Jacob

_______________________________________________
DejaGnu mailing list
DejaGnu@gnu.org
https://lists.gnu.org/mailman/listinfo/dejagnu

Reply via email to