chickadee » testdrive

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

testdrive

Driver program for continuous integration scripts.

Usage

testdrive [options...] [commands...]

Documentation

testdrive is a simple program for running a set of compilation and testing scripts with a single command. For each module defined in the configuration file, testdrive looks for a fetch script, build script, test script, and plot script. After these scripts have been run successfully, it constructs an HTML file with the results of all tests and any images generated by the plot script. Additionally, the configuration file can define variables that are expanded in the script files before they are run.

Order of operations

Given a configuration file testdrive performs the following operations for each module defined:

  1. change directory to the configuration directory for the current module;
  2. obtain the latest revision: using either the command specified in the configuration file or a script named `revisions'; this script is called with the module name as argument;
  3. fetch the module source code: using either the command specified in the configuration file or a script named `fetch'; this script is called with the module name, latest revision, and build location as arguments;
  4. build the module in the build location: either the command specified in the configuration file or a script named `build'; this script is called with the module name and build location as arguments;
  5. run the module tests: either the command specified in the configuration file or all scripts contained in subdirectory `tests'; this script is called with the module name and build location as arguments;
  6. produce module plots: the command specified in the configuration file or a script named `plots'; this script is called with the module name and build location as arguments;
  7. cleanup: (optional) command specified in the configuration file or a script named `cleanup'; if it exists this script is called with the module name and build location as arguments;

Expansion of variables in the script files

If the configuration file specifies an environment for the scripts (see next section), then before any of the scripts are run, text of the form VARIABLE will be expanded to the corresponding value given in the configuration file.

Example script files

#!/bin/sh
# revisions.sh: A script to obtain the latest revision of a file in SVN
svn info --username=anonymous --password=''   https://code.call-cc.org/svn/file.scm | grep Revision: | cut -f2 -d:
#!/bin/sh
# fetch.sh: A script to obtain a file of the given revision from SVN
MODULE_NAME=$1
VERSION=$2
BUILD_DIR=$3
svn export --username=anonymous --password='' -r $VERSION  https://code.call-cc.org/svn/file.scm $BUILD_DIR/file.scm
#!/bin/sh
# build.sh: A script to build a module
MODULE_NAME=$1
BUILD_DIR=$2
CHICKEN_DIR={{CHICKEN_DIR}}
cd $BUILD_DIR
$CHICKEN_DIR/bin/csc -o file file.scm
#!/bin/sh
# run.sh: A module test script
MODULE_NAME=$1
BUILD_DIR=$2
cd $BUILD_DIR
./file > test.dat
#! {{CHICKEN_DIR}}/bin/csi -script
;; plot.scm: A module plot script
(use srfi-1 posix ploticus)

(define (plot-log ... ))

(let ((args (command-line-arguments)))

  (let (
	(model-name (first args))
	(build-dir (second args))
	)	   
			
    (plot-log "test.dat" build-dir)
    ))

Configuration file format

The configuration file is loaded in the Scheme interpreter; i.e. it is a regular Scheme program which has access to two parameters specific to testdrive: env and modules.

env is an alist of variables which will be substituted in model scripts. modules is the list of modules, wheter each element is of the form:

 (module-id  (label . "Module label") (config-path . "/home/testdrive/module"))

module-id must be replaced by a unique identifier for this module. label is a descriptive label which will be used in the generated HTML report. config-path is the location of configuration scripts for this module.

Example configuration

 (define module-source-dir "/home/user/src/modules")

 (env `(
      (CHICKEN_DIR . "$HOME/bin/chicken")
      ))

 (modules `(
  (test_module
   (label . "Test module")
   (config-path  . ,(make-pathname module-source-dir "test")))
  ))

About this egg

Author

Ivan Raikov

Version history

1.4-1.5
Generation of several tables sorted by property
1.3
Table format for index page
1.1-1.2
Bug fix releases
1.0
Initial release

Requirements

License

Copyright 2013-2016 Ivan Raikov.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

A full copy of the GPL license can be found at
<http://www.gnu.org/licenses/>.