diff options
author | Steven Knight <knight@baldmt.com> | 2001-08-14 11:17:14 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2001-08-14 11:17:14 (GMT) |
commit | 7884cffaf3380a66a999ae8db12e0418f96993c0 (patch) | |
tree | 98d0b177f9b53719dc070c00f52332f653b65049 | |
parent | 062cbfc18a81e3b0c4147c4ead7cebff5e18063f (diff) | |
download | SCons-7884cffaf3380a66a999ae8db12e0418f96993c0.zip SCons-7884cffaf3380a66a999ae8db12e0418f96993c0.tar.gz SCons-7884cffaf3380a66a999ae8db12e0418f96993c0.tar.bz2 |
Clean up tests.
-rw-r--r-- | Construct | 6 | ||||
-rw-r--r-- | config | 10 | ||||
-rw-r--r-- | doc/Conscript | 1 | ||||
-rw-r--r-- | src/scons/BuilderTests.py | 34 | ||||
-rw-r--r-- | src/scons/EnvironmentTests.py | 32 | ||||
-rw-r--r-- | src/scons/Node/FSTests.py | 4 | ||||
-rw-r--r-- | src/scons/Node/NodeTests.py | 4 | ||||
-rw-r--r-- | src/scons/Sig/MD5Tests.py | 8 | ||||
-rw-r--r-- | src/scons/Sig/TimeStampTests.py | 7 | ||||
-rw-r--r-- | template/Tests.py | 3 | ||||
-rw-r--r-- | template/test.py | 6 | ||||
-rw-r--r-- | test/Program-j.py (renamed from test/t0002.py) | 10 | ||||
-rw-r--r-- | test/Program.py (renamed from test/t0010.py) | 8 | ||||
-rw-r--r-- | test/SConscript.py | 28 | ||||
-rw-r--r-- | test/option-f.py | 34 | ||||
-rw-r--r-- | test/option-j.py (renamed from test/t0001.py) | 12 | ||||
-rw-r--r-- | test/t0001.t | 30 |
17 files changed, 149 insertions, 88 deletions
@@ -21,6 +21,8 @@ $developer = $ARG{developer} || '???'; chomp($revision = $ARG{version} || `aesub '\$version' 2>/dev/null` || '0.01'); +chomp($change = $ARG{change} || `aesub '\$change' 2>/dev/null`); + @arr = split(/\./, $revision); @arr = ($arr[0], map {length($_) == 1 ? "0$_" : $_} @arr[1 .. $#arr]); $revision = join('.', @arr); @@ -109,8 +111,8 @@ Build 'build/doc/Conscript'; # that goes into the archive. # -foreach (`aegis -list cf 2>/dev/null`) { - $seen{"$1\n"}++ if /^source\s+remove\s.*\s(\S+)$/; +foreach (`aegis -list -unf -c $change cf 2>/dev/null`) { + $seen{"$1\n"}++ if /^(?:source|test) remove(?:\s.*)+\s(\S+)$/; } eval '@src_files = grep(! $seen{$_}++, @@ -34,7 +34,7 @@ * if the file is not in the change. Look in aesub(5) for more information * about command substitutions. */ -build_command = "cons date='${DAte %Y/%m/%d %H:%M:%S}' developer=${DEVeloper} version=${VERsion}"; +build_command = "cons date='${DAte %Y/%m/%d %H:%M:%S}' developer=${DEVeloper} version=${VERsion} change=${Change}"; /* * The rules used in the User Guide all remove their targets before @@ -244,6 +244,8 @@ diff_command = */ test_command = "python runtest.py -v ${VERsion} ${File_Name}"; +new_test_filename = "test/CHANGETHIS.py"; + /* * */ @@ -255,10 +257,14 @@ file_template = }, { pattern = [ "src/scons/*Tests.py" ]; - body = "${read_file ${source template/test.py abs}}"; + body = "${read_file ${source template/Tests.py abs}}"; }, { pattern = [ "src/scons/*.py" ]; body = "${read_file ${source template/file.py abs}}"; }, + { + pattern = [ "test/*.py" ]; + body = "${read_file ${source template/test.py abs}}"; + }, ]; diff --git a/doc/Conscript b/doc/Conscript index 948d8eb..75c2e9c 100644 --- a/doc/Conscript +++ b/doc/Conscript @@ -21,6 +21,7 @@ $doc_tar_gz = "#build/dist/scons-doc-$version.tar.gz"; # $verfile = SourcePath("version.sgml"); unlink($verfile); +chmod(0664, $verfile); open(FILE, ">$verfile") || die "Cannot open '$verfile': $!"; print FILE <<_EOF_; <!-- diff --git a/src/scons/BuilderTests.py b/src/scons/BuilderTests.py index a749bf2..df585df 100644 --- a/src/scons/BuilderTests.py +++ b/src/scons/BuilderTests.py @@ -30,14 +30,15 @@ outfile = test.workpath('outfile') class BuilderTestCase(unittest.TestCase): def test_action(self): - """Test the simple ability to create a Builder - and retrieve the supplied action attribute. + """Test Builder creation + + Verify that we can retrieve the supplied action attribute. """ builder = Builder(action = "foo") assert builder.action == "foo" def test_cmp(self): - """Test simple comparisons of Builder objects. + """Test simple comparisons of Builder objects """ b1 = Builder(input_suffix = '.o') b2 = Builder(input_suffix = '.o') @@ -47,9 +48,10 @@ class BuilderTestCase(unittest.TestCase): assert b2 != b3 def test_execute(self): - """Test the ability to execute simple Builders, one - a string that executes an external command, and one an - internal function. + """Test execution of simple Builder objects + + One Builder is a string that executes an external command, + and one is an internal Python function. """ cmd = "python %s %s xyzzy" % (act_py, outfile) builder = Builder(action = cmd) @@ -68,9 +70,10 @@ class BuilderTestCase(unittest.TestCase): assert test.read(outfile) == "function\n" def test_insuffix(self): - """Test the ability to create a Builder with a specified - input suffix, making sure that the '.' separator is - appended to the beginning if it isn't already present. + """Test Builder creation with a specified input suffix + + Make sure that the '.' separator is appended to the + beginning if it isn't already present. """ builder = Builder(input_suffix = '.c') assert builder.insuffix == '.c' @@ -78,15 +81,13 @@ class BuilderTestCase(unittest.TestCase): assert builder.insuffix == '.c' def test_name(self): - """Test the ability to create a Builder with a specified - name. + """Test Builder creation with a specified name """ builder = Builder(name = 'foo') assert builder.name == 'foo' def test_node_class(self): - """Test the ability to create a Builder that creates nodes - of the specified class. + """Test a Builder that creates nodes of a specified class """ class Foo: pass @@ -94,9 +95,10 @@ class BuilderTestCase(unittest.TestCase): assert builder.node_class is Foo def test_outsuffix(self): - """Test the ability to create a Builder with a specified - output suffix, making sure that the '.' separator is - appended to the beginning if it isn't already present. + """Test Builder creation with a specified output suffix + + Make sure that the '.' separator is appended to the + beginning if it isn't already present. """ builder = Builder(input_suffix = '.o') assert builder.insuffix == '.o' diff --git a/src/scons/EnvironmentTests.py b/src/scons/EnvironmentTests.py index 5d3e1ea..2f13c81 100644 --- a/src/scons/EnvironmentTests.py +++ b/src/scons/EnvironmentTests.py @@ -24,8 +24,9 @@ class Builder: class EnvironmentTestCase(unittest.TestCase): def test_Builders(self): - """Test the ability to execute simple builders through - different environment, one initialized with a single + """Test Builder execution through different environments + + One environment is initialized with a single Builder object, one with a list of a single Builder object, and one with a list of two Builder objects. """ @@ -57,7 +58,8 @@ class EnvironmentTestCase(unittest.TestCase): pass # XXX def test_Copy(self): - """Test the ability to copy a construction Environment. + """Test construction Environment copying + Update the copy independently afterwards and check that the original remains intact (that is, no dangling references point to objects in the copied environment). @@ -79,8 +81,9 @@ class EnvironmentTestCase(unittest.TestCase): assert env1 == env1copy def test_Dictionary(self): - """Test the simple ability to retrieve known construction - variables from the Dictionary and check for well-known + """Test retrieval of known construction variables + + Fetch them from the Dictionary and check for well-known defaults that get inserted. """ env = Environment(XXX = 'x', YYY = 'y') @@ -89,9 +92,10 @@ class EnvironmentTestCase(unittest.TestCase): assert env.Dictionary.has_key('BUILDERS') def test_Environment(self): - """Test the simple ability to create construction - Environments. Create two with identical arguments - and check that they compare the same. + """Test construction Environments creation + + Create two with identical arguments and check that + they compare the same. """ env1 = Environment(XXX = 'x', YYY = 'y') env2 = Environment(XXX = 'x', YYY = 'y') @@ -107,8 +111,9 @@ class EnvironmentTestCase(unittest.TestCase): pass # XXX def test_Update(self): - """Test the ability to update a construction Environment - with new construction variables after it was first created. + """Test updating an Environment with new construction variables + + After creation of the Environment, of course. """ env1 = Environment(AAA = 'a', BBB = 'b') env1.Update(BBB = 'bbb', CCC = 'ccc') @@ -116,9 +121,10 @@ class EnvironmentTestCase(unittest.TestCase): assert env1 != env2 def test_subst(self): - """Test the ability to substitute construction variables - into a string. Check various combinations, including - recursive expansion of variables into other variables. + """Test substituting construction variables within strings + + Check various combinations, including recursive expansion + of variables into other variables. """ env = Environment(AAA = 'a', BBB = 'b') str = env.subst("%AAA %{AAA}A %BBBB %BBB") diff --git a/src/scons/Node/FSTests.py b/src/scons/Node/FSTests.py index afa4340..14b62c2 100644 --- a/src/scons/Node/FSTests.py +++ b/src/scons/Node/FSTests.py @@ -19,7 +19,9 @@ class Builder: class FSTestCase(unittest.TestCase): def runTest(self): - """This test case handles all of the file system node + """Test FS (file system) Node operations + + This test case handles all of the file system node tests in one environment, so we don't have to set up a complicated directory structure for each test individually. """ diff --git a/src/scons/Node/NodeTests.py b/src/scons/Node/NodeTests.py index 92bc195..46292bc 100644 --- a/src/scons/Node/NodeTests.py +++ b/src/scons/Node/NodeTests.py @@ -20,7 +20,7 @@ class Builder: class NodeTestCase(unittest.TestCase): def test_build(self): - """Test the ability to build a node. + """Test building a node """ node = Node() node.builder_set(Builder()) @@ -30,6 +30,8 @@ class NodeTestCase(unittest.TestCase): assert built_it def test_builder_set(self): + """Test setting a Node's Builder + """ node = Node() b = Builder() node.builder_set(b) diff --git a/src/scons/Sig/MD5Tests.py b/src/scons/Sig/MD5Tests.py index ac43f1b..efcec7f 100644 --- a/src/scons/Sig/MD5Tests.py +++ b/src/scons/Sig/MD5Tests.py @@ -35,8 +35,9 @@ class MD5TestCase(unittest.TestCase): pass # XXX def test_current(self): - """Test the ability to decide if an object is up-to-date - with different signature values. + """Test deciding if an object is up-to-date + + Simple comparison of different "signature" values. """ o111 = my_obj(value = '111') assert not o111.current(scons.Sig.MD5.signature('110')) @@ -50,8 +51,7 @@ class MD5TestCase(unittest.TestCase): pass # XXX def test_collect(self): - """Test the ability to collect a sequence of object signatures - into a new signature value. + """Test collecting a list of signatures into a new signature value """ o1 = my_obj(value = '111') o2 = my_obj(value = '222') diff --git a/src/scons/Sig/TimeStampTests.py b/src/scons/Sig/TimeStampTests.py index aa61af8..4fb1920 100644 --- a/src/scons/Sig/TimeStampTests.py +++ b/src/scons/Sig/TimeStampTests.py @@ -32,8 +32,9 @@ class TimeStampTestCase(unittest.TestCase): pass # XXX def test_current(self): - """Test the ability to decide if an object is up-to-date - with different timestamp values. + """Test deciding if an object is up-to-date + + Simple comparison of different timestamp values. """ o1 = my_obj(value = 111) assert scons.Sig.TimeStamp.current(o1, 110) @@ -47,7 +48,7 @@ class TimeStampTestCase(unittest.TestCase): pass # XXX def test_collect(self): - """Test the ability to collect a sequence of object timestamps + """Test collecting a list of signatures into a new signature value into a new timestamp value. """ o1 = my_obj(value = 111) diff --git a/template/Tests.py b/template/Tests.py new file mode 100644 index 0000000..64d9cdf --- /dev/null +++ b/template/Tests.py @@ -0,0 +1,3 @@ +__revision__ = "${subst '^src/scons/' '' $filename} __REVISION__ __DATE__ __DEVELOPER__" + +import unittest diff --git a/template/test.py b/template/test.py index b43a73f..4f7d8ff 100644 --- a/template/test.py +++ b/template/test.py @@ -1,3 +1,5 @@ -__revision__ = "${subst '^src/scons/' '' $filename} __REVISION__ __DATE__ __DEVELOPER__" +#!/usr/bin/env python -from TestCmd import TestCmd +__revision__ = "$filename __REVISION__ __DATE__ __DEVELOPER__" + +import TestCmd diff --git a/test/t0002.py b/test/Program-j.py index 0cdfa81..822c64f 100644 --- a/test/t0002.py +++ b/test/Program-j.py @@ -1,12 +1,12 @@ #!/usr/bin/env python -__revision__ = "test/t0002.py __REVISION__ __DATE__ __DEVELOPER__" +__revision__ = "test/Program-j.py __REVISION__ __DATE__ __DEVELOPER__" -from TestCmd import TestCmd +import TestCmd -test = TestCmd(program = 'scons.py', - workdir = '', - interpreter = 'python') +test = TestCmd.TestCmd(program = 'scons.py', + workdir = '', + interpreter = 'python') test.write('SConstruct', """ env = Environment() diff --git a/test/t0010.py b/test/Program.py index 9d00a7f..78edf92 100644 --- a/test/t0010.py +++ b/test/Program.py @@ -1,10 +1,12 @@ #!/usr/bin/env python -__revision__ = "test/t0001.t __REVISION__ __DATE__ __DEVELOPER__" +__revision__ = "test/Program.py __REVISION__ __DATE__ __DEVELOPER__" -from TestCmd import TestCmd +import TestCmd -test = TestCmd(program = 'scons.py', workdir = '', interpreter = 'python') +test = TestCmd.TestCmd(program = 'scons.py', + workdir = '', + interpreter = 'python') test.write('SConstruct', """ env = Environment() diff --git a/test/SConscript.py b/test/SConscript.py new file mode 100644 index 0000000..de24d68 --- /dev/null +++ b/test/SConscript.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +__revision__ = "test/SConscript.py __REVISION__ __DATE__ __DEVELOPER__" + +import TestCmd + +test = TestCmd.TestCmd(program = 'scons.py', + workdir = '', + interpreter = 'python') + +test.write('SConstruct', """ +import os +print "SConstruct", os.getcwd() +Conscript('SConscript') +""") + +# XXX I THINK THEY SHOULD HAVE TO RE-IMPORT OS HERE +test.write('SConscript', """ +import os +print "SConscript " + os.getcwd() +""") + +wpath = test.workpath() + +test.run(chdir = '.') +test.fail_test(test.stdout() != ("SConstruct %s\nSConscript %s\n" % (wpath, wpath))) + +test.pass_test() diff --git a/test/option-f.py b/test/option-f.py new file mode 100644 index 0000000..e52532e --- /dev/null +++ b/test/option-f.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +__revision__ = "test/option-f.py __REVISION__ __DATE__ __DEVELOPER__" + +import TestCmd +import os.path + +test = TestCmd.TestCmd(program = 'scons.py', + workdir = '', + interpreter = 'python') + +test.subdir('subdir') + +subdir_BuildThis = os.path.join('subdir', 'Buildthis') + +test.write('SConscript', """ +import os +print "SConscript " + os.getcwd() +""") + +test.write(subdir_BuildThis, """ +import os +print "subdir/BuildThis", os.getcwd() +""") + +wpath = test.workpath() + +test.run(chdir = '.', arguments = '-f SConscript') +test.fail_test(test.stdout() != ("SConscript %s\n" % wpath)) + +test.run(chdir = '.', arguments = '-f ' + subdir_BuildThis) +test.fail_test(test.stdout() != ("subdir/BuildThis %s\n" % wpath)) + +test.pass_test() diff --git a/test/t0001.py b/test/option-j.py index 824e046..ae403a6 100644 --- a/test/t0001.py +++ b/test/option-j.py @@ -1,8 +1,8 @@ #!/usr/bin/env python -__revision__ = "test/t0001.py __REVISION__ __DATE__ __DEVELOPER__" +__revision__ = "test/option-j.py __REVISION__ __DATE__ __DEVELOPER__" -from TestCmd import TestCmd +import TestCmd import string import sys @@ -12,13 +12,13 @@ try: except ImportError: # if threads are not supported, then # there is nothing to test - test.pass_test() + TestCmd.no_result() sys.exit() -test = TestCmd(program = 'scons.py', - workdir = '', - interpreter = 'python') +test = TestCmd.TestCmd(program = 'scons.py', + workdir = '', + interpreter = 'python') test.write('build.py', r""" import time diff --git a/test/t0001.t b/test/t0001.t deleted file mode 100644 index 8f9bed3..0000000 --- a/test/t0001.t +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python - -__revision__ = "test/t0001.t __REVISION__ __DATE__ __DEVELOPER__" - -from TestCmd import TestCmd - -test = TestCmd(program = 'scons.py', workdir = '', interpreter = 'python') - -test.write('SConstruct', """ -import os -print "SConstruct", os.getcwd() -Conscript('SConscript') -""") - -# XXX I THINK THEY SHOULD HAVE TO RE-IMPORT OS HERE, -# WHICH THEY DO FOR THE SECOND TEST BELOW, BUT NOT THE FIRST... -test.write('SConscript', """ -import os -print "SConscript " + os.getcwd() -""") - -wpath = test.workpath() - -test.run(chdir = '.') -test.fail_test(test.stdout() != ("SConstruct %s\nSConscript %s\n" % (wpath, wpath))) - -test.run(chdir = '.', arguments = '-f SConscript') -test.fail_test(test.stdout() != ("SConscript %s\n" % wpath)) - -test.pass_test() |