Next: , Previous: , Up: testing   [Contents][Index]


23.2 A script to run tests

MBFL comes with a script that can be used to handle the execution of tests; it is called mbfltest.sh. Synopsis:

mbfltest.sh [options] TESTFILE ...

supported options are all the MBFL generic ones (Predefined options) and additionally:

--start

Print start messages for tests, it is the same as invoking dotest-set-report-start().

--end

Print end messages for tests, it is the same as invoking dotest-set-report-success().

--match=VALUE

Select match pattern for tests, it is the same as setting the TESTMATCH variable.

--directory=VALUE

Change directory before executing tests, but after having located the test files on the file system.

--library=VALUE

Select a specific version of the MBFL library.

When running tests with the script: in the test modules we can omit the sourcing of MBFL and the MBFL test library, mbfltest.sh does this before sourcing the test module. Each test module is evaluated in a bash subprocess, so: there is no interference between modules; each module has to do its own initialisation and finalisation.

With GNU Make we can do:

MBFLTEST        = mbfltest.sh
MBFLTEST_FLAGS  = --end
ifneq (,$(TESTMATCH))
MBFLTEST_FLAGS  += --match=$(TESTMATCH)
endif

srcdir          = ...
testdir         = $(srcdir)/tests
TESTNAME        = *
TESTFILES       = $(wildcard $(testdir)/$(TESTNAME).test)

.PHONY: test tests

ifneq ($(strip $(TESTFILES)),)
test tests:
        $(MBFLTEST) $(MBFLTEST_FLAGS) $(TESTFILES)
endif

Next: , Previous: , Up: testing   [Contents][Index]

This document describes version 3.0.0-devel.0 of Marcos Bash Functions Library.