diff --git a/.bzrignore b/.bzrignore index 2abfefe..23e54cb 100644 --- a/.bzrignore +++ b/.bzrignore @@ -2,3 +2,30 @@ ./c/tests/test_child .sconsign .sconsign.dblite +./m4/** +aclocal.m4 +compile +config.guess +config.h.in +config.sub +configure +depcomp +install-sh +ltmain.sh +missing +autom4te.cache +Makefile.in +py-compile +.deps +.dirstamp +.libs +*.lo +libsubunit.la +subunit-0.0.1.tar.gz +libtool +stamp-h1 +libsubunit.pc +config.log +config.status +Makefile +config.h diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..655c3df --- /dev/null +++ b/INSTALL @@ -0,0 +1,9 @@ +To install subunit +------------------ + +Bootstrap:: + autoreconf -vi +Configure:: + ./configure +Install:: + make install diff --git a/Makefile b/Makefile deleted file mode 100644 index 02d2b16..0000000 --- a/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -check: - scons -Q check - -all: - scons -Q - -clean: - scons -Q -c - -install: - scons -Q install - -.PHONY: all check clean install diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..1a5aa0a --- /dev/null +++ b/Makefile.am @@ -0,0 +1,71 @@ +EXTRA_DIST = \ + INSTALL \ + Makefile.am \ + README \ + c/README \ + c/check-subunit-0.9.3.patch \ + c/check-subunit-0.9.5.patch \ + c/check-subunit-0.9.6.patch \ + c++/README \ + c++/cppunit-subunit-1.10.2.patch \ + python/subunit/__init__.py \ + python/subunit/tests/TestUtil.py \ + python/subunit/tests/__init__.py \ + python/subunit/tests/sample-script.py \ + python/subunit/tests/sample-two-script.py \ + python/subunit/tests/test_subunit_filter.py \ + python/subunit/tests/test_subunit_stats.py \ + python/subunit/tests/test_subunit_tags.py \ + python/subunit/tests/test_tap2subunit.py \ + python/subunit/tests/test_test_protocol.py \ + runtests.py \ + shell/README \ + shell/share/subunit.sh \ + shell/subunit-ui.patch \ + shell/tests/test_function_output.sh \ + shell/tests/test_source_library.sh + +ACLOCAL_AMFLAGS = -I m4 + +SUBUNIT_CFLAGS = -Wall -Werror -Wextra -Wstrict-prototypes -Wmissing-prototypes \ + -Wwrite-strings -Wno-variadic-macros -I$(top_srcdir)/c/include +AM_CFLAGS = $(SUBUNIT_CFLAGS) + +include_subunitdir = $(includedir)/subunit + +dist_bin_SCRIPTS = \ + filters/subunit-filter \ + filters/subunit-ls \ + filters/subunit-stats \ + filters/subunit-tags \ + filters/subunit2pyunit \ + filters/tap2subunit + +TESTS_ENVIRONMENT = SHELL_SHARE='$(top_srcdir)/shell/share/' PYTHONPATH='$(abs_top_srcdir)/python':${PYTHONPATH} +TESTS = runtests.py $(check_PROGRAMS) + +## install libsubunit.pc +pcdatadir = $(libdir)/pkgconfig +pcdata_DATA = libsubunit.pc + +pkgpython_PYTHON = \ + python/subunit/__init__.py + +lib_LTLIBRARIES = libsubunit.la + +include_subunit_HEADERS = \ + c/include/subunit/child.h + +check_PROGRAMS = \ + c/tests/test_child + +check_SCRIPTS = \ + runtests.py + +libsubunit_la_SOURCES = \ + c/lib/child.c \ + c/include/subunit/child.h + +tests_LDADD = @CHECK_LIBS@ $(top_builddir)/libsubunit.la +c_tests_test_child_CFLAGS = $(SUBUNIT_CFLAGS) @CHECK_CFLAGS@ +c_tests_test_child_LDADD = $(tests_LDADD) diff --git a/SConstruct b/SConstruct deleted file mode 100644 index 4ea16e9..0000000 --- a/SConstruct +++ /dev/null @@ -1,43 +0,0 @@ -# setup our tools -import os.path -import sys - -# we want the subunit source in the path so we can use it to run -# the tests. Yes this does make everything fall over in a screaming -# heap when you break it - so dont break it -# the system subunit does not have tests installed. So ensure we -# use the devel copy. -sys.path.insert(0, os.path.abspath('python')) -import subunit - -default_root = os.path.expanduser('~/local/') -DESTDIR=ARGUMENTS.get('DESTDIR', default_root) -if DESTDIR[-1] != '/': - DESTDIR += '/' -include = os.path.join(DESTDIR, "include", "subunit") -lib = os.path.join(DESTDIR, "lib") -bin = os.path.join(DESTDIR, "bin") -env = Environment() -tests = [] -Export('bin', 'env', 'lib', 'include', 'DESTDIR', 'tests') - -# support tools -def run_test_scripts(source, target, env, for_signature): - """Run all the sources as executable scripts which return 0 on success.""" - # TODO: make this cross platform compatible. - return ["LD_LIBRARY_PATH=%s %s" % (os.path.join(str(target[0].dir), - env['LIBPATH']), a_source) for a_source in source] -test_script_runner = Builder(generator=run_test_scripts) -def run_python_scripts(source, target, env, for_signature): - """Run all the sources as executable scripts which return 0 on success.""" - return ["PYTHONPATH=%s python %s" % (env['PYTHONPATH'], a_source) for a_source in source] -python_test_runner = Builder(generator=run_python_scripts) -env.Append(BUILDERS = {'TestRC' : test_script_runner, - 'TestPython' : python_test_runner}) - -# tests -tests.append(env.TestPython('check_python', 'runtests.py', PYTHONPATH='python')) - -SConscript(dirs=['c', 'c++', 'filters', 'python', 'shell']) - -env.Alias('check', tests) diff --git a/c++/SConscript b/c++/SConscript deleted file mode 100644 index b36cae9..0000000 --- a/c++/SConscript +++ /dev/null @@ -1,2 +0,0 @@ -Import('*') -# describe what we need for C++ diff --git a/c/SConscript b/c/SConscript deleted file mode 100644 index c1dc767..0000000 --- a/c/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -Import('*') -# describe what we need for C -subunit = SharedLibrary('lib/subunit', ['lib/child.c']) -test_child = Program('tests/test_child.c', - LIBS=['check', 'subunit'], - CPPPATH='include', - LIBPATH='lib') -tests.append(env.TestRC('check', test_child, LIBPATH='lib')) -installs=[] -installs.append(env.Install(lib, subunit)) -installs.append(env.Install(include, 'include/subunit/child.h')) -env.Alias('install', installs) -Default(subunit) - diff --git a/c/lib/child.c b/c/lib/child.c index 302c50f..a733bc2 100644 --- a/c/lib/child.c +++ b/c/lib/child.c @@ -20,6 +20,7 @@ #include #include +#include "subunit/child.h" /* these functions all flush to ensure that the test runner knows the action * that has been taken even if the subsequent test etc takes a long time or diff --git a/c/tests/test_child.c b/c/tests/test_child.c index 3dcd10d..307ec09 100644 --- a/c/tests/test_child.c +++ b/c/tests/test_child.c @@ -138,9 +138,9 @@ call_test_error(void) } -START_TEST (error) +START_TEST (test_error) { - test_stdout_function("failure: test case [\n" + test_stdout_function("error: test case [\n" "Multiple lines\n" " of output\n" "]\n", @@ -148,9 +148,7 @@ START_TEST (error) } END_TEST - - -Suite * +static Suite * child_suite(void) { Suite *s = suite_create("subunit_child"); @@ -159,6 +157,7 @@ child_suite(void) tcase_add_test (tc_core, test_start); tcase_add_test (tc_core, test_pass); tcase_add_test (tc_core, test_fail); + tcase_add_test (tc_core, test_error); return s; } diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..88b01c2 --- /dev/null +++ b/configure.ac @@ -0,0 +1,56 @@ +AC_DEFUN([SUBUNIT_MAJOR_VERSION], [0]) +AC_DEFUN([SUBUNIT_MINOR_VERSION], [0]) +AC_DEFUN([SUBUNIT_MICRO_VERSION], [1]) +AC_DEFUN([SUBUNIT_VERSION], +[SUBUNIT_MAJOR_VERSION.SUBUNIT_MINOR_VERSION.SUBUNIT_MICRO_VERSION]) +AC_PREREQ([2.59]) +AC_INIT([subunit], [SUBUNIT_VERSION], [subunit-dev@lists.launchpad.net]) +AC_CONFIG_SRCDIR([c/lib/child.c]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) +AC_CONFIG_MACRO_DIR([m4]) +[SUBUNIT_MAJOR_VERSION]=SUBUNIT_MAJOR_VERSION +[SUBUNIT_MINOR_VERSION]=SUBUNIT_MINOR_VERSION +[SUBUNIT_MICRO_VERSION]=SUBUNIT_MICRO_VERSION +[SUBUNIT_VERSION]=SUBUNIT_VERSION +AC_SUBST([SUBUNIT_MAJOR_VERSION]) +AC_SUBST([SUBUNIT_MINOR_VERSION]) +AC_SUBST([SUBUNIT_MICRO_VERSION]) +AC_SUBST([SUBUNIT_VERSION]) +AC_USE_SYSTEM_EXTENSIONS +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_LIBTOOL +AM_PATH_PYTHON +# Checks for libraries. + +# Checks for header files. +AC_CHECK_HEADERS([stdlib.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_HEADER_TIME +AC_STRUCT_TM + +AC_CHECK_SIZEOF(int, 4) +AC_CHECK_SIZEOF(short, 2) +AC_CHECK_SIZEOF(long, 4) + +# Checks for library functions. +AC_FUNC_MALLOC +AC_FUNC_REALLOC + +# Easier memory management. +# C unit testing. +PKG_CHECK_MODULES([CHECK], [check >= 0.9.4]) + +# Output files +AC_CONFIG_HEADERS([config.h]) + +AC_CONFIG_FILES([libsubunit.pc + Makefile + ]) +AC_OUTPUT diff --git a/filters/SConscript b/filters/SConscript deleted file mode 100644 index 9f58123..0000000 --- a/filters/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -Import('*') -# describe what we need for filters -filters = [ - 'subunit-filter', - 'subunit-ls', - 'subunit-stats', - 'subunit-tags', - 'subunit2pyunit', - 'tap2subunit', - ] -installs = [] -for filter in filters: - installs.append(env.Install(bin, filter)) -env.Alias('install', installs) diff --git a/libsubunit.pc.in b/libsubunit.pc.in new file mode 100644 index 0000000..6756414 --- /dev/null +++ b/libsubunit.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: subunit +Description: Subunit test protocol library. +URL: http://launchpad.net/subunit +Version: @VERSION@ +Libs: -L${libdir} -lsubunit +Cflags: -I${includedir} diff --git a/python/SConscript b/python/SConscript deleted file mode 100644 index 8eb1136..0000000 --- a/python/SConscript +++ /dev/null @@ -1,20 +0,0 @@ -Import('*') -# describe what we need for Python - -EnsurePythonVersion(2, 4) - -import distutils.sysconfig -import os.path - -# distutils default prefix is the common path between -# distutils.sysconfig.get_python_lib and distutils.sysconfig.get_python_inc -prefix = os.path.commonprefix([ - distutils.sysconfig.get_python_lib(), - distutils.sysconfig.get_python_inc(), - ]) -# suffix to install .py files to is distutils.sysconfig.get_python_lib() -# after the common prefix -python_suffix = distutils.sysconfig.get_python_lib()[len(prefix):] -# install path for python is then in DESTDIR + python_suffix -python_installdir = DESTDIR + python_suffix + '/subunit' -env.Alias('install', [Install(python_installdir, 'subunit/__init__.py')]) diff --git a/shell/SConscript b/shell/SConscript deleted file mode 100644 index bf585eb..0000000 --- a/shell/SConscript +++ /dev/null @@ -1,5 +0,0 @@ -Import('*') -# describe what we need for Shell - -shell_lib_installdir = DESTDIR + '/share/subunit' -env.Alias('install', [Install(shell_lib_installdir, 'share/subunit.sh')]) diff --git a/shell/tests/test_function_output.sh b/shell/tests/test_function_output.sh index 787281a..068abf7 100755 --- a/shell/tests/test_function_output.sh +++ b/shell/tests/test_function_output.sh @@ -27,7 +27,7 @@ # have not, this test script may well fail strangely. # import the library. -. shell/share/subunit.sh +. ${SHELL_SHARE}subunit.sh echo 'test: subunit_start_test output' func_output=$(subunit_start_test "foo bar") diff --git a/shell/tests/test_source_library.sh b/shell/tests/test_source_library.sh index 264d5d2..81eef83 100755 --- a/shell/tests/test_source_library.sh +++ b/shell/tests/test_source_library.sh @@ -26,7 +26,7 @@ echo 'test: shell bindings can be sourced' # if any output occurs, this has failed to source cleanly -source_output=$(. shell/share/subunit.sh 2>&1) +source_output=$(. ${SHELL_SHARE}subunit.sh 2>&1) if [ $? == 0 -a "x$source_output" = "x" ]; then echo 'success: shell bindings can be sourced' else @@ -37,7 +37,7 @@ else fi # now source it for real -. shell/share/subunit.sh +. ${SHELL_SHARE}subunit.sh # we should have a start_test function echo 'test: subunit_start_test exists'