Tests for EDB


This file describes how to run tests, and how to write new ones, for EDB.

* running

  Use "make check" to run all the tests:

    make check

  To specify a subset, pass their names via the ‘TESTS’ var to the invocation.
  For example:

    make check TESTS='alive.test skram.test'

  Normally, running displays only "PASS" or "FAIL" for each test.  To see
  progress, including (possible) reasons for failure, add ‘DEBUG’ like so:

    make check DEBUG=1

  At the end, you'll see the overall result as either "All N tests passed" or
  "M of N tests failed", with the according exit value (0 or 1, respectively).

* naming

  Tests are named w/ extension ".test" and should be chmod +x (executable).
  Regression tests are named bNN.test, where NN is a decimal number.

* anatomy

  Tests should begin w/

    ":"; exec ./ebatch --no-site-file -l $0 ;# -*- emacs-lisp -*-

  on the first line, which is an sh-compatible invocation of the ‘ebatch’
  script in this directory, with the test name.  You can omit ‘--no-site-file’
  if that shouldn't make a difference in the test.

  The rest of the file contains Emacs Lisp expressions to set up test cases,
  perform tests, report progress and results (optionally), and signal failure
  by calling ‘error’.  The first forms is usually:

    (require 'database)

  Look at b00.test for example.

* environment

  During test execution, three env vars are set by the test harness:

  - MAKE -- the ‘make’ program
  - srcdir -- the "tests" directory
  - topsrcdir -- the top source directory

  If you are building in place (having invoked configure as ‘./configure’),
  then ‘srcdir’ is "." and ‘topsrcdir’ is the absolute filename of the parent
  directory.



Copyright (C) 2020 Thien-Thi Nguyen

Copying and distribution of this file, with or without modification,
are permitted provided the copyright notice and this notice are preserved.
