Commit 5f7d4181 authored by Jose A. Lopes's avatar Jose A. Lopes Committed by Michele Tartara

Fix single-execution of Haskell tests and shelltests

Add Makefile.am target hs-test-% for single-execution of Haskell
tests.

Add Makefile.am target hs-shell-% for single-execution of Haskell
shelltests.

Update documentation on running individual tests.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 4c18846f
......@@ -20,6 +20,9 @@ strip_hsroot = $(patsubst src/%,%,$(patsubst test/hs/%,%,$(1)))
# Use bash in order to be able to use pipefail
SHELL=/bin/bash
# Enable colors in shelltest
SHELLTESTARGS = "-c"
ACLOCAL_AMFLAGS = -I autotools
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
......@@ -1827,15 +1830,30 @@ check-local: check-dirs $(GENERATED_FILES)
done; \
test -z "$$error"
.PHONY: hs-test-%
hs-test-%: test/hs/htest | $(BUILT_PYTHON_SOURCES)
@rm -f htest.tix
test/hs/htest -t $*
.PHONY: hs-tests
hs-tests: test/hs/htest | $(BUILT_PYTHON_SOURCES)
@rm -f htest.tix
./test/hs/htest
.PHONY: hs-shell-%
hs-shell-%: test/hs/hpc-htools test/hs/hpc-mon-collector \
$(HS_BUILT_TEST_HELPERS)
@rm -f hpc-htools.tix hpc-mon-collector.tix
HBINARY="./test/hs/hpc-htools" \
SHELLTESTARGS=$(SHELLTESTARGS) \
./test/hs/offline-test.sh $*
.PHONY: hs-shell
hs-shell: test/hs/hpc-htools test/hs/hpc-mon-collector $(HS_BUILT_TEST_HELPERS)
@rm -f hpc-htools.tix hpc-mon-collector.tix
HBINARY="./test/hs/hpc-htools" ./test/hs/offline-test.sh
HBINARY="./test/hs/hpc-htools" \
SHELLTESTARGS=$(SHELLTESTARGS) \
./test/hs/offline-test.sh
.PHONY: hs-check
hs-check: hs-tests hs-shell
......
......@@ -24,7 +24,7 @@ Most dependencies from :doc:`install-quick`, including ``qemu-img``
- `pep8 <https://github.com/jcrocholl/pep8/>`_
- `PyYAML <http://pyyaml.org/>`_
For older developement (Ganeti < 2.4) ``docbook`` was used instead
For older developement (Ganeti < 2.4) ``docbook`` was used instead of
``pandoc``.
Note that for pylint, at the current moment the following versions
......@@ -175,8 +175,8 @@ Running individual tests
~~~~~~~~~~~~~~~~~~~~~~~~
When developing code, running the entire test suite can be
slow. Running individual tests is possible easily for unit-tests, less
so for shell-tests (but these are faster, so it shouldn't be needed).
slow. Running individual tests is possible. There are different
Makefile targets for running individual Python and Haskell tests.
For Python tests::
......@@ -185,15 +185,33 @@ For Python tests::
For Haskell tests::
$ make test/hs/htest && ./test/hs/htest -t %pattern%
$ make hs-test-%pattern%
Where ``pattern`` can be a simple test pattern (e.g. ``comma``,
matching any test whose name contains ``comma``), a test pattern
denoting a group (ending with a slash, e.g. ``Utils/``), or more
complex glob pattern. For more details, see the documentation (on the
`test-framework homepage
complex glob pattern. For more details, search for glob patterns in
the documentation of `test-framework
<http://batterseapower.github.com/test-framework/>`_).
For individual Haskell shelltests::
$ make hs-shell-%name%
which runs the test ``test/hs/shelltests/htools-%name%.test``. For
example, to run the test ``test/hs/shelltests/htools-balancing.test``,
use::
$ make hs-shell-balancing
For combined Haskell shelltests::
$ make hs-shell-{%name1%,%name2%,...}
for example::
$ make hs-shell-{balancing,basic}
Packaging notes
===============
......
......@@ -20,6 +20,14 @@
# This is an offline testing script for most/all of the htools
# programs, checking basic command line functionality.
# Optional argument that specifies the test files to run. If not
# specified, then all tests are run.
#
# For example, a value of 'balancing' runs the file
# 'shelltests/htools-balancing.test'. Multiple files can be specified
# using shell notation, for example, '{balancing,basic}'.
TESTS=${1:-*}
set -e
set -o pipefail
......@@ -97,7 +105,4 @@ echo OK
echo Running shelltest...
shelltest $SHELLTESTARGS \
${TOP_SRCDIR:-.}/test/hs/shelltests/htools-*.test \
-- --hide-successes
echo All OK
${TOP_SRCDIR:-.}/test/hs/shelltests/htools-$TESTS.test
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment