Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ptest(1P) — Ultrix-32 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1)

chmod(1)

diff(1)

make(1)

mkmf(1P)

PTEST(1P)

NAME

ptest − test a project module

SYNOPSIS

ptest [−d] [−F template] [−P projectname] [module ...]

DESCRIPTION

Ptest does regression testing on project modules.  Individual modules can be selected for testing, or if ptest is given without module arguments, all of the modules in a project are tested. Modules can be programs, libraries, or functions. 

For each module to be tested there must exist an archive containing a test program, input data, and test results.  Ptest tests a module by extracting the archive, compiling the test program, executing the test, and comparing the output with expected test results using the diff program:

Ttest  <  Itest  |  diff  −  Otest

where test is the name of the module test. If the test output differs from expected results, the test fails and error diagnostics are saved in a file named ‘Etest’. 

Compiling The Test Program

If an archive contains a compilable test program, ptest uses mkmf to edit the file name of the test program into a makefile which is then used by make to compile the program. If there are other source code file names in the current working directory, these are also included in the makefile. This mechanism allows experimental versions of functions to be tested since they will override any other occurrences of the functions (e.g. in a library). 

Creating Test Archives

Archives containing module tests reside in the ‘test’ directory located in the project root directory. Each archive must be created by the ar command and given the name test.a where test is the name of a module test. These archives include the following files:

(a)‘Ttest.lang’ test program source code. The file name suffix, lang, identifies the programming language in which the test program is written. 

(b)‘Ttest.sh’ shell command script. ‘Ttest.sh’ executes a test and compares the test output with expected results stored in the archive.  If the output matchs expected results, ‘Ttest.sh’ returns with exit code 0. If the results differ, the exit code should be non-zero. 

Note: the shell command script must be made executable by doing:

chmod  +x  Ttest.sh

If a ‘Ttest.sh’ file is not found in the archive, ptest executes the following command:

Ttest  <  Itest  |  diff  −  Otest

or if there is no ‘Itest’ data file:

Ttest  |  diff  −  Otest

(c)‘Itest’ data file for test input. 

(d)‘Otest’ data file for validated test output. The output from a module test will be compared against the information in this file. If no output is expected, this file should be zero size. 

The files ‘Ttest.lang’, ‘Ttest.sh’, and ‘Itest’ may be omitted from the archive. 

OPTIONS

−dLeave the files that have been extracted from an archive, in the current directory for debugging purposes. 

−F template
Specify an alternative makefile template file name. The default file name is ‘t.Makefile’. 

−P projectname
Specify a project other than the current working project.

FILES

/usr/new/lib/t.MakefileStandard test program makefile template.
project/lib/t.MakefileUser-defined test program makefile template.
project/test/*.aProject test archives.
test.aModule test archive.
EtestModule error diagnostic file.
ItestModule input data file.
OtestModule validated output data file.
TtestCompiled module test program.
Ttest.shModule shell command script.
T_makefileTest program makefile.

SEE ALSO

ar(1), chmod(1), diff(1), make(1), mkmf(1P)

DIAGNOSTICS

Exit status 0 if the test succeeds. Exit status 1 if it fails. 

AUTHOR

Peter J. Nicklin

BUGS

Since the PATH environment variable governs the order in which directories are searched for executable commands, the production version of a command may be used instead of an experimental version. 

Any files beginning with ‘T’ (except those with suffix ‘.sh’) are deleted prior to each test. 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026