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

salmonella

  1. salmonella
    1. Introduction
    2. Author
    3. Repository
    4. Tools
      1. salmonella
        1. Command line options
        2. Some quick tips by example
          1. Using salmonella as an egg lint tool
      2. salmonella-log-viewer
      3. salmonella-epidemy
      4. salmonella-log-merger
      5. Log file format
        1. <egg>
        2. <action>
        3. <status>
        4. <message>
        5. <duration>
    5. Modules
      1. salmonella
        1. report
        2. report->list
        3. log!
        4. make-salmonella
          1. (salmonella 'init-repo!)
          2. (salmonella 'clear-repo!)
          3. (salmonella 'fetch <egg>)
          4. (salmonella 'install <egg>)
          5. (salmonella 'test <egg>)
          6. (salmonella 'check-version <egg>)
          7. (salmonella 'env-info)
          8. (salmonella 'meta-data <egg>)
          9. (salmonella 'check-dependencies <egg> <meta data>)
          10. (salmonella 'check-category <egg> <meta data>)
          11. (salmonella 'check-license <egg> <meta data>)
          12. (salmonella 'check-author <egg> <meta data>)
          13. (salmonella 'check-doc <egg>)
      2. salmonella-log-parser
        1. Reading
        2. fetch action
          1. fetch-status
          2. fetch-message
          3. fetch-duration
        3. install action
          1. install-status
          2. install-message
          3. install-duration
        4. check-version action
          1. check-version-status
          2. check-version-message
          3. egg-version
          4. check-version-ok?
        5. test action
          1. test-status
          2. test-message
          3. test-duration
          4. has-test?
        6. meta-data action
          1. meta-data
          2. egg-dependencies
          3. egg-license
        7. check-doc action
          1. doc-exists?
        8. start & end actions
          1. start-time
          2. end-time
          3. total-time
          4. salmonella-info
        9. Statistics
          1. count-install-ok
          2. count-install-fail
          3. count-test-ok
          4. count-test-fail
          5. count-no-test
          6. count-total-eggs
          7. count-documented
          8. count-undocumented
        10. Miscelaneous
          1. prettify-time
          2. sort-eggs
          3. log-eggs
          4. log-skipped-eggs
    6. Environment variables
    7. Caveats
      1. Testing executable files installed by eggs
      2. salmonella-epidemy on Windows
    8. License
    9. Version history
      1. Version 2.7
      2. Version 2.6
      3. Version 2.5
      4. Version 2.4
      5. Version 2.3
      6. Version 2.2
      7. Version 2.1
      8. Version 2.0

Introduction

Salmonella is a set of tools to test CHICKEN eggs. Here's a brief summary of features:

Note: starting on version 2.0, salmonella is a rewrite of the salmonella 1.x series, which was available since CHICKEN 2.x. The documentation for the 1.x series is still available at http://wiki.call-cc.org/egg/salmonella-1.x.

Author

Mario Domenech Goulart

Repository

salmonella is hosted on github: https://github.com/mario-goulart/salmonella

Tools

This egg provides some command line tools. The next sections describe each of them.

salmonella

This is the core tool for testing eggs. salmonella can perform the following tests:

salmonella generates a sexpr-based log file as output. That file can be used by tools like salmonella-html-report to generate a pretty output in HTML.

When executing, salmonella prints some basic information on the standard output. Detailed information can be viewed with the aforementioned salmonella-html-report or with salmonella-log-viewer, a tool which is provided by this egg. salmonella-log-viewer parses the log file generated by salmonella and formats the data on the standard output.

Command line options

Here's the output of salmonella -h with an explanation for each command line option:

 salmonella [ -h | --help ]
 salmonella <options> eggs
 <options>:
 --log-file=<logfile>
     The name for the log file to be generated by salmonella
     (default=salmonella.log).
 --chicken-installation-prefix=<prefix dir>
     If you want to test eggs using a chicken installed on a certain directory,
     you can use this option (it should point to the same directory as given to
     `PREFIX' when installing CHICKEN). If omitted, salmonella uses CHICKEN
     tools from the current runtime's installation prefix.
 --chicken-install-args=<install args>
     This option can be used customize chicken-install's arguments.  You can
     use <repo> to indicate where you want the actual repository directory
     to be replaced by salmonella.
 --eggs-source-dir=<eggs dir>
     By default, salmonella fetches eggs from the egg server.  If you have a
     local copy of eggs code, you can use this option to point to the directory
     where they are located.
 --eggs-doc-dir=<doc dir>
     By default, salmonella checks if documentation for eggs exist by accessing
     the CHICKEN wiki.  If you have a local copy of the wiki documentation for
     eggs, you can use this option to point to the directory where they can be
     found.
 --keep-repo
     For each egg that salmonella tests, it sets the egg installation repository
     empty and removes it at the end of its execution.  This option makes
     salmonella keep the egg installation repository after testing each egg and
     after finishing its execution.  This option can save a lot of time when
     testing several eggs, at the cost of potentially making salmonella unable
     to catch dependencies problems.
 --skip-eggs=<comma-separated list of eggs to skip>
     A comma-separated list of eggs to be skipped.
 --repo-dir=<path to repo dir to be used>
     Alternative location for the egg installation directory used by salmonella.
     By default, salmonella generates a `salmonella-tmp-xxxxx' directory in the
     current directory.  This option can be useful when used with `--keep-repo'
     to reuse egg installation repositories for several salmonella executions.
 --verbosity=<number>
     A number to indicate salmonella's verbosity level.  0 means practically
     silent. 1 is mostly silent and 2 (default) prints some useful information
     while salmonella is running.
Some quick tips by example

Simplest case: testing eggs using the remote egg server and the chicken tools (chicken-install and csi) in the system PATH

 $ salmonella big-chicken slice

You can test all the available eggs using one of the following approaches:

1. If you have CHICKEN >= 4.7.2:

 $ salmonella `chicken-install -list`

2. If you don't have CHICKEN >= 4.7.2:

 $ salmonella `wget http://code.call-cc.org/cgi-bin/henrietta.cgi?list=1 -q -O -`

If you don't want to test some specific eggs, you can skip them:

 $ salmonella --skip-eggs=macosx,hfs+ `chicken-install -list`

You can tell salmonella to use a specific CHICKEN version:

 $ salmonella --chicken-installation-prefix=/usr/local/chicken-4.7.3 big-chicken slice

Not cleaning the egg installation repository after installing each egg may significantly speed up the salmonella execution time (the default behavior is to set the egg installation repository empty after testing each egg):

 $ salmonella --keep-repo big-chicken slice

warning: if you use --keep-repo, salmonella will not be able to catch dependencies problems.

If you want to reuse the same egg installation repository for multiple salmonella runs, you can provide a specific directory:

 $ salmonella --repo-dir=my-repo --keep-repo big-chicken slice

By default, salmonella generates a log file named salmonella.log in the current directory. You can change that by using the --log-file command line option:

 $ salmonella --log-file=my-log-file.log big-chicken slice
Using salmonella as an egg lint tool

Suppose you are working on a new egg and you want to check if it is working ok before releasing it (or a new version). You can use salmonella to check it:

 $ cd my-egg    # where your egg code is stored
 $ salmonella

salmonella-log-viewer

This tool can be used to turn salmonella log files into something readable on the standard output.

Just provide a salmonella log file as argument to salmonella-log-viewer:

   $ salmonella-log-viewer salmonella.log

Alternatively, you can use salmonella-html-report for a prettier and more complete format.

salmonella-epidemy

Note: this tool is currently not supported on Windows systems.

salmonella-epidemy can be used to run multiple salmonella instances in parallel. It can be handy when you have a multi-core machine and you want to make use of all cores, for example. The command line options are basically the same as for salmonella, plus a --instances=<number> to indicate how many salmonella instances you want to run in parallel.

This tool can significantly speed up salmonella execution times on multi-core machines.

Usage example:

 $ salmonella-epidemy --instances=2 big-chicken slice spiffy amb

salmonella-log-merger

This tool simply puts more than one salmonella log into a single one, so it can be used by tools like salmonella-log-viewer and salmonella-html-report.

Usage example:

 $ salmonella-log-merger --log-file=full.log file1.log file2.log

Log file format

The command line tool writes a log file which contains records in the following format:

(<egg> <action> <status> <message> <duration>)
<egg>

Can be either a symbol that indicates the egg-name or #f to indicate the start and end actions (logged when salmonella is started and when it finishes testing, respectively).

<action>

A symbol to indicate the action that was executed. Can be one of the following values:

<status>

A numeric value indicating the exit status of the executed action. When the action is test and status is -1, it means that the egg has no tests.

<message>

The output generated by the commands executed to perform <action>. A string.

<duration>

The time (in seconds) that was taken to execute <action>.

For the start and end actions, the value is the seconds since epoch, so the total salmonella execution time can be determined by subtracting the start time from the end time.

Modules

Salmonella provides two modules:

salmonella
the core salmonella functionality and basic data strucuture for logs (report records)
salmonella-log-parser
provides procedures to access log files and compute simple statistics regarding log file data.

salmonella

report
[record] (report egg action status message duration)
[procedure] make-report
[procedure] report?
[procedure] report-egg
[procedure] report-action
[procedure] report-status
[procedure] report-message
[procedure] report-duration
[procedure] report-egg-set!
[procedure] report-action-set!
[procedure] report-status-set!
[procedure] report-message-set!
[procedure] report-duration-set!

report objects. Each log file registry is represented by a report object (serialized as a list).

report->list
[procedure] (report->list report)

Convert a report object to a list.

log!
[procedure] (log! report log-file)

Print the report representation to log-file.

make-salmonella
[procedure] (make-salmonella tmp-dir #!key chicken-installation-prefix chicken-install-args eggs-source-dir eggs-doc-dir this-egg?)

The salmonella maker. Returns a procedure that receives symbols (methods) to indicate the actions to be performed. The available methods are (example considering a salmonella object returned by make-salmonella):

(salmonella 'init-repo!)
(salmonella 'clear-repo!)
(salmonella 'fetch <egg>)
(salmonella 'install <egg>)
(salmonella 'test <egg>)
(salmonella 'check-version <egg>)
(salmonella 'env-info)
(salmonella 'meta-data <egg>)
(salmonella 'check-dependencies <egg> <meta data>)
(salmonella 'check-category <egg> <meta data>)
(salmonella 'check-license <egg> <meta data>)
(salmonella 'check-author <egg> <meta data>)
(salmonella 'check-doc <egg>)

salmonella-log-parser

Reading
[procedure] (read-log-file filename)

Reads the log file filename and returns a list of report records.

fetch action
fetch-status
[procedure] (fetch-status egg log)
fetch-message
[procedure] (fetch-message egg log)
fetch-duration
[procedure] (fetch-duration egg log)
install action
install-status
[procedure] (install-status egg log)
install-message
[procedure] (install-message egg log)
install-duration
[procedure] (install-duration egg log)
check-version action
check-version-status
[procedure] (check-version-status egg log)
check-version-message
[procedure] (check-version-message egg log)
egg-version
[procedure] (egg-version egg log)
check-version-ok?
[procedure] (check-version-ok? egg log)
test action
test-status
[procedure] (test-status egg log)
test-message
[procedure] (test-message egg log)
test-duration
[procedure] (test-duration egg log)
has-test?
[procedure] (has-test? egg log)
meta-data action
meta-data
[procedure] (meta-data egg log)
egg-dependencies
[procedure] (egg-dependencies egg log)
egg-license
[procedure] (egg-license egg log #!key with-test-dependencies? with-versions?)
check-doc action
doc-exists?
[procedure] (doc-exists? egg log)
start & end actions
start-time
[procedure] (start-time log)
end-time
[procedure] (end-time log)
total-time
[procedure] (total-time log)
salmonella-info
[procedure] (salmonella-info log)
Statistics
count-install-ok
[procedure] (count-install-ok log)
count-install-fail
[procedure] (count-install-fail log)
count-test-ok
[procedure] (count-test-ok log)
count-test-fail
[procedure] (count-test-fail log)
count-no-test
[procedure] (count-no-test log)
count-total-eggs
[procedure] (count-total-eggs log #!key with-skipped?)
count-documented
[procedure] (count-documented log)
count-undocumented
[procedure] (count-undocumented log)
Miscelaneous
prettify-time
[procedure] (prettify-time time)
sort-eggs
[procedure] (sort-eggs eggs)
log-eggs
[procedure] (log-eggs log)
log-skipped-eggs
[procedure] (log-skipped-eggs log)

Environment variables

When running, salmonella sets the SALMONELLA_RUNNING environment variable. If you need to check if your tests code is being run by salmonella, this variable can be used.

Caveats

Testing executable files installed by eggs

Salmonella sets a private repository to install and test eggs, so when extensions install programs, they get installed into <salmonella-repo-dir>/bin, not into $CHICKEN_PREFIX/bin.

So, how to invoke (from tests/run.scm, for example) a binary executable file your egg installs? You have the following options:

So far the only "portable" solution is a combination of both options, which happens to be a bit ugly. Salmonella sets the SALMONELLA_RUNNING environment variable when it runs, so your test script may check that variable and assume your test executable will be found in PATH if it is set. If SALMONELLA_RUNNING is not set, just build up the absolute path to your executable using (program-path). Here's an example:

(define executable
  (make-pathname
   (if (get-environment-variable "SALMONELLA_RUNNING")
       #f ;; salmonella adds its REPO_PREFIX/bin to PATH
       (program-path))
   "executable-filename"))

salmonella-epidemy on Windows

salmonella-epidemy is currently not supported on Windows systems.

License

BSD

Version history

Version 2.7

Version 2.6

Version 2.5

Version 2.4

Version 2.3

Version 2.2

Version 2.1

Version 2.0