dejagnu
[Top][All Lists]
Advanced

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

Can we deprecate $subdir?


From: Jacob Bachmeyer
Subject: Can we deprecate $subdir?
Date: Sat, 24 Nov 2018 19:43:41 -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

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.

The comments in runtest.exp mention "XXX this is silly" when "subdir" is set, so I ask: Can we deprecate the "subdir" variable?

A sketch for an API call:

testsuite file ?-source|-build? -top|-tool|-test ?-hypothetical? ?--? <name>... Takes any number of file names and combines them as by "file join", prepending the full name of a directory relevant to the testsuite. If no names are given, that directory is returned.

The directory prepended will be from the build tree if -build is given, otherwise from the source tree if -source is given or the option is omitted. The level within that tree is selected by the second option: -top specifies the "testsuite" directory itself, -tool specifies the directory that was selected by the --tool option that led to running the current test, and -test selects the directory containing the current test script.

Unless the -hypothetical option is given, any directories implied by the returned value will exist upon return. An error is raised if a directory implied by the result in the source tree does not exist. A directory implied in the build tree will be created if it does not already exist. More precisely, if -build was given and the full name produced by joining all names given as arguments except the last does not exist in the filesystem, a directory will be created under that name, then the last <name> argument is appended and the result returned.

An optional -- terminates options and is needed if the first <name> might begin with a "-" character.


This API call would allow replacing all of the *dir variables in test scripts, which will avoid needing to copy the values into slave interpreters in the future.

Some equivalances:
   $testsuitedir == [testsuite file -source -top]
$srcdir/$subdir == [testsuite file -source -test] == [file dirname [info script]]
   $objdir/$subdir == [testsuite file -build -test]

This could also lead to deprecating the "srcdir" and "objdir" variables in test scripts, but not in init files, which would continue to be run in the master interpreter, and may be expected to set those variables.


-- Jacob




reply via email to

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