[Top][All Lists]

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

Re: Can we deprecate $subdir?

From: Jacob Bachmeyer
Subject: Re: Can we deprecate $subdir?
Date: Sun, 25 Nov 2018 20:00:08 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20090807 MultiZilla/ SeaMonkey/1.1.17 Mnenhy/

Ben Elliston wrote:
On Sat, Nov 24, 2018 at 07:43:41PM -0600, Jacob Bachmeyer wrote:
As part of the ongoing effort to improve Automake integration and
mindful of the eventual goal to run test scripts in slave
interpreters, I have come to the conclusion that it would be better
to provide an API call for getting filenames in the testsuite rather
than expecting test scripts to use variables.  API calls can be
aliased back into a master interpreter, while variable namespaces
are separate between interpreters.

In principle, I like this idea.

It's difficult to properly control an API when users have direct
access to internal variables of the test framework.

If test scripts are ever moved to slave interpreters, the internal variables will disappear. Similar results will occur if/when DejaGnu code is moved into Tcl namespaces (although the "exported" variables could remain globals in that case). Moving DejaGnu into namespaces would greatly reduce the effort required to write a test script; currently, writing test scripts can feel like tap-dancing in a minefield: even seemingly generic names like "text" can be (and if certain libraries are loaded that one is) global variables on whose values DejaGnu depends for correct operation. Tcl 8 has namespaces; we should use them to lower the barrier to entry for using DejaGnu. (Moving the DejaGnu core into namespaces is on my local TODO list. Importing namespaced procedures into the global namespace will provide backwards compatibility. Procedures not actually part of the API can be deprecated in this way as well: the global version produces a deprecation warning but passes the call into the relevant namespace.)

$subdir is going to be difficult (*), but perhaps we could do
something like adding another runtest option that helps the
maintainers of testsuites to find and remove deprecated features (for
example, by not setting $subdir and catching the error as it
propagates up to runtest.exp).

* The GCC testsuite uses $subdir extensively and I'm sure other
testsuites do, too.

What? Deprecating a variable looks easy, with a bit more infrastructure: set a read trace on that variable and record any accesses from outside the DejaGnu core. After printing the summary, emit a warning if any deprecated variables or procedures were used. In verbose mode, also list where the variable was accessed.

A goal is that the API call be usable as a "drop-in" replacement: search/replace "$srcdir/$subdir" to "[testsuite file -source -test]" and "$objdir/$subdir" to "[testsuite file -build -test]" should be an easy and correct, but perhaps sub-optimal, migration.

-- Jacob

reply via email to

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