Clean up tests.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 14 Aug 2001 11:17:14 +0000 (11:17 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 14 Aug 2001 11:17:14 +0000 (11:17 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@23 fdb21ef1-2011-0410-befe-b5e4ea1792b1

17 files changed:
Construct
config
doc/Conscript
src/scons/BuilderTests.py
src/scons/EnvironmentTests.py
src/scons/Node/FSTests.py
src/scons/Node/NodeTests.py
src/scons/Sig/MD5Tests.py
src/scons/Sig/TimeStampTests.py
template/Tests.py [new file with mode: 0644]
template/test.py
test/Program-j.py [moved from test/t0002.py with 83% similarity]
test/Program.py [moved from test/t0010.py with 63% similarity]
test/SConscript.py [new file with mode: 0644]
test/option-f.py [new file with mode: 0644]
test/option-j.py [moved from test/t0001.py with 84% similarity]
test/t0001.t [deleted file]

index 6fe36338137d584ad2a106de82e814dc96e5544b..559591a16ecf1edb49ebaf72982ca37f6efb1ce1 100644 (file)
--- a/Construct
+++ b/Construct
@@ -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{$_}++,
diff --git a/config b/config
index c36eaf0aac947d6e48c315559487f1ba8b47ccdf..bad5168ffbbaa4f4f1472e860ecc31f2d6a7acc1 100644 (file)
--- a/config
+++ b/config
@@ -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}}";
+       },
 ];
index 948d8eb91b152911f6914ab4cc71a9ea005cd3cd..75c2e9c9895ebaaf7856dce53429e6e775f81c45 100644 (file)
@@ -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_;
 <!--
index a749bf22e974623d5280aafdfad41f39b2edfbbb..df585df5979f74859dc85b40f4b975fb5cd11d34 100644 (file)
@@ -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'
index 5d3e1ea30e6507feb051a32840f919c8443f427b..2f13c8198d0f7289d56276e2663f584354357ecc 100644 (file)
@@ -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")
index afa4340a4b39da74067470eb9c6aa19c2e282bec..14b62c285811de118a6f5f7168683eedcdb3414d 100644 (file)
@@ -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.
        """
index 92bc1958b25817f6fdf66904e7698f9a0c34a59f..46292bc23aec2d3277446fe5acb9b9cd2ae8d800 100644 (file)
@@ -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)
index ac43f1ba2ccddf4c88c34eb96c489f62485c8a50..efcec7f968bcb2d2923a0b15cf69adef03dc1ba9 100644 (file)
@@ -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')
index aa61af80efbc4b779be2af983722726c055e5e86..4fb1920861967ab05bd0e5bc928e9e9285db3088 100644 (file)
@@ -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 (file)
index 0000000..64d9cdf
--- /dev/null
@@ -0,0 +1,3 @@
+__revision__ = "${subst '^src/scons/' '' $filename} __REVISION__ __DATE__ __DEVELOPER__"
+
+import unittest
index b43a73fd81820bc020084e9e75b8b6f2ee2863be..4f7d8ffb21610e72bde27666dc50b99a09816d0e 100644 (file)
@@ -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
similarity index 83%
rename from test/t0002.py
rename to test/Program-j.py
index 0cdfa81a5cba71e0b48e12ebf33477553b245673..822c64fa1e9620a1b7aaa7ff517802dd66c2496e 100644 (file)
@@ -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()
similarity index 63%
rename from test/t0010.py
rename to test/Program.py
index 9d00a7fde52ab090c6a1d2a558b20247b60aafd3..78edf9222097f1b944cba8007d16dfaf69f2afa2 100644 (file)
@@ -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 (file)
index 0000000..de24d68
--- /dev/null
@@ -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 (file)
index 0000000..e52532e
--- /dev/null
@@ -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()
similarity index 84%
rename from test/t0001.py
rename to test/option-j.py
index 824e046e2d35711fa0e8b4ce9d6e22d7977f8120..ae403a6a268e57ed5e261515c7e98069dbbdc2ac 100644 (file)
@@ -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 (file)
index 8f9bed3..0000000
+++ /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()