From e8c8cf1acd8385959611994ab1f343b08774d83e Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Thu, 11 Mar 2010 18:28:54 +0100 Subject: [PATCH] Add support for non-Python unittests Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- Makefile.am | 16 +++++++++++----- autotools/testrunner | 28 ++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) create mode 100755 autotools/testrunner diff --git a/Makefile.am b/Makefile.am index 64b15e631..bf97265ba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -247,6 +247,7 @@ EXTRA_DIST = \ autotools/check-man \ autotools/docbook-wrapper \ autotools/gen-coverage \ + autotools/testrunner \ $(RUN_IN_TEMPDIR) \ daemons/daemon-util.in \ daemons/ganeti-cleaner.in \ @@ -318,7 +319,7 @@ TEST_FILES = \ test/data/proc_drbd80-emptyline.txt \ test/data/proc_drbd83.txt -dist_TESTS = \ +python_tests = \ test/ganeti.bdev_unittest.py \ test/ganeti.cli_unittest.py \ test/ganeti.cmdlib_unittest.py \ @@ -340,6 +341,9 @@ dist_TESTS = \ test/docs_unittest.py \ test/tempfile_fork_unittest.py +dist_TESTS = \ + $(python_tests) + nodist_TESTS = TESTS = $(dist_TESTS) $(nodist_TESTS) @@ -349,12 +353,13 @@ PLAIN_TESTS_ENVIRONMENT = \ PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR) # Environment for tests run by automake -TESTS_ENVIRONMENT = $(PLAIN_TESTS_ENVIRONMENT) $(PYTHON) +TESTS_ENVIRONMENT = \ + $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner all_python_code = \ $(dist_sbin_SCRIPTS) \ $(dist_tools_SCRIPTS) \ - $(dist_TESTS) \ + $(python_tests) \ $(pkgpython_PYTHON) \ $(hypervisor_PYTHON) \ $(rapi_PYTHON) \ @@ -545,12 +550,13 @@ TAGS: $(BUILT_SOURCES) etags - .PHONY: coverage -coverage: $(BUILT_SOURCES) $(TESTS) +coverage: $(BUILT_SOURCES) $(python_tests) set -e; \ mkdir -p doc/coverage; \ COVERAGE_FILE=$(CURDIR)/doc/coverage/data \ TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \ HTML_COVERAGE=$(CURDIR)/doc/coverage \ - $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage $(TESTS) + $(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \ + $(python_tests) # vim: set noet : diff --git a/autotools/testrunner b/autotools/testrunner new file mode 100755 index 000000000..d933613d3 --- /dev/null +++ b/autotools/testrunner @@ -0,0 +1,28 @@ +#!/bin/bash +# + +# Copyright (C) 2010 Google Inc. +# +# 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 2 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +set -e + +filename=$1 + +case "$filename" in + *.py) exec $PYTHON "$@" ;; + *) exec "$@" ;; +esac -- GitLab