Switch to autoconf.

This commit is contained in:
Robert Collins 2009-05-08 13:53:52 +10:00
parent a5a8f00dc2
commit e492ccf34d
16 changed files with 182 additions and 119 deletions

View File

@ -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

9
INSTALL Normal file
View File

@ -0,0 +1,9 @@
To install subunit
------------------
Bootstrap::
autoreconf -vi
Configure::
./configure
Install::
make install

View File

@ -1,13 +0,0 @@
check:
scons -Q check
all:
scons -Q
clean:
scons -Q -c
install:
scons -Q install
.PHONY: all check clean install

71
Makefile.am Normal file
View File

@ -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)

View File

@ -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)

View File

@ -1,2 +0,0 @@
Import('*')
# describe what we need for C++

View File

@ -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)

View File

@ -20,6 +20,7 @@
#include <stdio.h>
#include <string.h>
#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

View File

@ -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;
}

56
configure.ac Normal file
View File

@ -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

View File

@ -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)

11
libsubunit.pc.in Normal file
View File

@ -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}

View File

@ -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')])

View File

@ -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')])

View File

@ -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")

View File

@ -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'