You are looking at historical revision 28632 of this page. It may differ significantly from its current revision.

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;

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

  1. revisions script
#!/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:
  1. fetch script
#!/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
  1. build script
#!/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
  1. test script
#!/bin/sh
# run.sh: A module test script
MODULE_NAME=$1
BUILD_DIR=$2
cd $BUILD_DIR
./file > test.dat
  1. plot script
#! {{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

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.0
Initial release

Requirements

License

Copyright 2013 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/>.