diff options
author | Robert Collins <robertc@robertcollins.net> | 2006-04-17 14:13:35 +1000 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2006-04-17 14:13:35 +1000 |
commit | 4ff83274f7a9c20297c3484e994ba584c1771b31 (patch) | |
tree | 7271a783780b915b7212f8c389f214ed1c71974c | |
parent | f1767091373ba1c3bb98af804b3bcb16802604c0 (diff) | |
download | subunit-git-4ff83274f7a9c20297c3484e994ba584c1771b31.tar.gz |
Finish stage one conversion to scons.
-rw-r--r-- | Makefile | 20 | ||||
-rw-r--r-- | SConstruct | 41 | ||||
-rw-r--r-- | c++/SConscript | 2 | ||||
-rw-r--r-- | c/Makefile | 13 | ||||
-rw-r--r-- | c/SConscript | 16 | ||||
-rw-r--r-- | c/SConstruct | 34 | ||||
-rw-r--r-- | python/SConscript | 24 | ||||
-rwxr-xr-x | python/test_python.py (renamed from test_all.py) | 0 | ||||
-rw-r--r-- | shell/Makefile | 7 | ||||
-rw-r--r-- | shell/SConscript | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | shell/test_shell.py | 4 | ||||
-rwxr-xr-x | shell/tests/test_function_output.sh | 2 | ||||
-rwxr-xr-x | shell/tests/test_source_library.sh | 6 |
13 files changed, 111 insertions, 70 deletions
@@ -1,13 +1,13 @@ -PYTHONPATH:=$(shell pwd)/python:${PYTHONPATH} +check: + scons -Q check all: + scons -Q -check: - # check the core python bindings. - PYTHONPATH=$(PYTHONPATH) python ./test_all.py $(TESTRULE) - # shell bindings - PYTHONPATH=$(PYTHONPATH) make -C shell check - # C bindings - PYTHONPATH=$(PYTHONPATH) make -C c check - -.PHONY: all +clean: + scons -Q -c + +install: + scons -Q install + +.PHONY: all check clean install diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000..339b1b1 --- /dev/null +++ b/SConstruct @@ -0,0 +1,41 @@ +# 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 = "#export/$PLATFORM/bin" +env = Environment() +Export('env', 'lib', 'include', 'DESTDIR') + +# 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" % (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 %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}) + + +SConscript([ + 'c/SConscript', + 'c++/SConscript', + 'python/SConscript', + 'shell/SConscript']) diff --git a/c++/SConscript b/c++/SConscript new file mode 100644 index 0000000..b36cae9 --- /dev/null +++ b/c++/SConscript @@ -0,0 +1,2 @@ +Import('*') +# describe what we need for C++ diff --git a/c/Makefile b/c/Makefile deleted file mode 100644 index 0de9221..0000000 --- a/c/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -all: - scons -Q - -check: - scons check - -clean: - scons -c - -install: - scons install - -.PHONY: all check clean install diff --git a/c/SConscript b/c/SConscript new file mode 100644 index 0000000..8468378 --- /dev/null +++ b/c/SConscript @@ -0,0 +1,16 @@ +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=[] +tests.append(env.TestRC('check', test_child, LIBPATH='lib')) +env.Alias('check', tests) +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/SConstruct b/c/SConstruct deleted file mode 100644 index 7f08c10..0000000 --- a/c/SConstruct +++ /dev/null @@ -1,34 +0,0 @@ -# setup our tools -import os.path - -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 = "#export/$PLATFORM/bin" -env = Environment() -Export('env') - -# 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" % (env['LIBPATH'], a_source) for a_source in source] -test_script_runner = Builder(generator=run_test_scripts) -env.Append(BUILDERS = {'TestRC' : test_script_runner}) - - -# describe what we need -subunit = SharedLibrary('lib/subunit', ['lib/child.c']) -test_child = Program('tests/test_child.c', - LIBS=['check', 'subunit'], - CPPPATH='include', - LIBPATH='lib') -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/python/SConscript b/python/SConscript new file mode 100644 index 0000000..416ff9f --- /dev/null +++ b/python/SConscript @@ -0,0 +1,24 @@ +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')]) +# tests +tests = [] +tests.append(env.TestPython('check_python', 'test_python.py', PYTHONPATH='python')) +env.Alias('check', tests) diff --git a/test_all.py b/python/test_python.py index 399d27f..399d27f 100755 --- a/test_all.py +++ b/python/test_python.py diff --git a/shell/Makefile b/shell/Makefile deleted file mode 100644 index 8a84b7a..0000000 --- a/shell/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: - -check: - # check the shell bindings. - python ./test_shell.py $(TESTRULE) - -.PHONY: all check diff --git a/shell/SConscript b/shell/SConscript new file mode 100644 index 0000000..bb705d0 --- /dev/null +++ b/shell/SConscript @@ -0,0 +1,12 @@ +Import('*') +# describe what we need for Shell + +import test_shell + +shell_lib_installdir = DESTDIR + '/share/subunit' +env.Alias('install', [Install(shell_lib_installdir, 'share/subunit.sh')]) + +# tests +tests = [] +tests.append(env.TestPython('check_shell', 'test_shell.py', PYTHONPATH='python')) +env.Alias('check', tests) diff --git a/shell/test_shell.py b/shell/test_shell.py index cf891aa..a88a49c 100644..100755 --- a/shell/test_shell.py +++ b/shell/test_shell.py @@ -31,10 +31,10 @@ import logging class ShellTests(subunit.ExecTestCase): def test_sourcing(self): - """./tests/test_source_library.sh""" + """./shell/tests/test_source_library.sh""" def test_functions(self): - """./tests/test_function_output.sh""" + """./shell/tests/test_function_output.sh""" def test_suite(): diff --git a/shell/tests/test_function_output.sh b/shell/tests/test_function_output.sh index 35831f4..adda595 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. -. 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 765e42d..1b672b2 100755 --- a/shell/tests/test_source_library.sh +++ b/shell/tests/test_source_library.sh @@ -22,11 +22,11 @@ # It manually implements the control protocol so that it des not depend on the # bindings being complete yet. -# we expect to be run from the 'shell' tree root. +# we expect to be run from the tree root. echo 'test: shell bindings can be sourced' # if any output occurs, this has failed to source cleanly -source_output=$(. 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 -. share/subunit.sh +. shell/share/subunit.sh # we should have a start_test function echo 'test: subunit_start_test exists' |