Anonymous avatar Anonymous committed 2c1833f

Clean up tests.

Comments (0)

Files changed (20)

 
 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);
 # 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{$_}++,
  * 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
  */
 test_command = "python runtest.py -v ${VERsion} ${File_Name}";
 
+new_test_filename = "test/CHANGETHIS.py";
+
 /*
  *
  */
 	},
 	{
 		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}}";
+	},
 ];
 #
 $verfile = SourcePath("version.sgml");
 unlink($verfile);
+chmod(0664, $verfile);
 open(FILE, ">$verfile") || die "Cannot open '$verfile': $!";
 print FILE <<_EOF_;
 <!--

src/scons/BuilderTests.py

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

src/scons/EnvironmentTests.py

 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.
 	"""
 	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).
 	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')
 	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')
 	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')
 	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")

src/scons/Node/FSTests.py

 
 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.
 	"""

src/scons/Node/NodeTests.py

 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())
 	assert built_it
 
     def test_builder_set(self):
+	"""Test setting a Node's Builder
+	"""
 	node = Node()
 	b = Builder()
 	node.builder_set(b)

src/scons/Sig/MD5Tests.py

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

src/scons/Sig/TimeStampTests.py

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

template/Tests.py

+__revision__ = "${subst '^src/scons/' '' $filename} __REVISION__ __DATE__ __DEVELOPER__"
+
+import unittest
-__revision__ = "${subst '^src/scons/' '' $filename} __REVISION__ __DATE__ __DEVELOPER__"
+#!/usr/bin/env python
 
-from TestCmd import TestCmd
+__revision__ = "$filename __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestCmd

test/Program-j.py

+#!/usr/bin/env python
+
+__revision__ = "test/Program-j.py __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestCmd
+
+test = TestCmd.TestCmd(program = 'scons.py',
+                       workdir = '',
+                       interpreter = 'python')
+
+test.write('SConstruct', """
+env = Environment()
+env.Program(target = 'f1', source = 'f1.c')
+env.Program(target = 'f2', source = 'f2.c')
+env.Program(target = 'f3', source = 'f3.c')
+env.Program(target = 'f4', source = 'f4.c')
+""")
+
+test.write('f1.c', """
+int
+main(int argc, char *argv[])
+{
+    printf(\"f1.c\n\");
+    exit (0);
+}
+""")
+
+test.write('f2.c', """
+int
+main(int argc, char *argv[])
+{
+    printf(\"f2.c\n\");
+    exit (0);
+}
+""")
+
+
+test.write('f3.c', """
+int
+main(int argc, char *argv[])
+{
+    printf(\"f3.c\n\");
+    exit (0);
+}
+""")
+
+test.write('f4.c', """
+int
+main(int argc, char *argv[])
+{
+    printf(\"f4.c\n\");
+    exit (0);
+}
+""")
+
+
+test.run(chdir = '.', arguments = '-j 3 f1 f2 f3 f4')
+
+test.run(program = test.workpath('f1'))
+test.fail_test(test.stdout() != "f1.c\n")
+
+test.run(program = test.workpath('f2'))
+test.fail_test(test.stdout() != "f2.c\n")
+
+test.run(program = test.workpath('f3'))
+test.fail_test(test.stdout() != "f3.c\n")
+
+test.run(program = test.workpath('f4'))
+test.fail_test(test.stdout() != "f4.c\n")
+
+
+test.pass_test()
+#!/usr/bin/env python
+
+__revision__ = "test/Program.py __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestCmd
+
+test = TestCmd.TestCmd(program = 'scons.py',
+                       workdir = '',
+                       interpreter = 'python')
+
+test.write('SConstruct', """
+env = Environment()
+env.Program(target = 'foo', source = 'foo.c')
+""")
+
+test.write('foo.c', """
+int
+main(int argc, char *argv[])
+{
+	printf("foo.c\n");
+	exit (0);
+}
+""")
+
+test.run(chdir = '.', arguments = 'foo')
+
+test.run(program = test.workpath('foo'))
+
+test.fail_test(test.stdout() != "foo.c\n")
+
+test.pass_test()

test/SConscript.py

+#!/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()
+#!/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()
+#!/usr/bin/env python
+
+__revision__ = "test/option-j.py __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestCmd
+import string
+import sys
+
+
+try:
+    import threading
+except ImportError:
+    # if threads are not supported, then
+    # there is nothing to test
+    TestCmd.no_result()
+    sys.exit()
+
+
+test = TestCmd.TestCmd(program = 'scons.py',
+                       workdir = '',
+                       interpreter = 'python')
+
+test.write('build.py', r"""
+import time
+import sys
+file = open(sys.argv[1], 'w')
+file.write(str(time.time()) + '\n')
+time.sleep(1)
+file.write(str(time.time()))
+file.close()
+""")
+
+test.write('SConstruct', """
+MyBuild = Builder(name = "MyBuild",
+		  action = "python build.py %(target)s")
+env = Environment(BUILDERS = [MyBuild])
+env.MyBuild(target = 'f1', source = 'f1.in')
+env.MyBuild(target = 'f2', source = 'f2.in')
+""")
+
+def RunTest(args):
+    test.write('f1.in', 'f1.in')
+    test.write('f2.in', 'f2.in')
+
+    test.run(chdir = '.', arguments = args)
+
+    str = test.read("f1")
+    start1,finish1 = map(float, string.split(str, "\n"))
+
+    str = test.read("f2")
+    start2,finish2 = map(float, string.split(str, "\n"))
+
+    return start2, finish1
+
+start2, finish1 = RunTest('-j 2 f1 f2')
+
+# fail if the second file was not started
+# before the first one was finished
+test.fail_test(not (start2 < finish1))
+
+start2, finish1 = RunTest('f1 f2')
+
+# fail if the second file was started
+# before the first one was finished
+test.fail_test(start2 < finish1)
+
+test.pass_test()
+ 

test/t0001.py

-#!/usr/bin/env python
-
-__revision__ = "test/t0001.py __REVISION__ __DATE__ __DEVELOPER__"
-
-from TestCmd import TestCmd
-import string
-import sys
-
-
-try:
-    import threading
-except ImportError:
-    # if threads are not supported, then
-    # there is nothing to test
-    test.pass_test()
-    sys.exit()
-
-
-test = TestCmd(program = 'scons.py',
-               workdir = '',
-               interpreter = 'python')
-
-test.write('build.py', r"""
-import time
-import sys
-file = open(sys.argv[1], 'w')
-file.write(str(time.time()) + '\n')
-time.sleep(1)
-file.write(str(time.time()))
-file.close()
-""")
-
-test.write('SConstruct', """
-MyBuild = Builder(name = "MyBuild",
-		  action = "python build.py %(target)s")
-env = Environment(BUILDERS = [MyBuild])
-env.MyBuild(target = 'f1', source = 'f1.in')
-env.MyBuild(target = 'f2', source = 'f2.in')
-""")
-
-def RunTest(args):
-    test.write('f1.in', 'f1.in')
-    test.write('f2.in', 'f2.in')
-
-    test.run(chdir = '.', arguments = args)
-
-    str = test.read("f1")
-    start1,finish1 = map(float, string.split(str, "\n"))
-
-    str = test.read("f2")
-    start2,finish2 = map(float, string.split(str, "\n"))
-
-    return start2, finish1
-
-start2, finish1 = RunTest('-j 2 f1 f2')
-
-# fail if the second file was not started
-# before the first one was finished
-test.fail_test(not (start2 < finish1))
-
-start2, finish1 = RunTest('f1 f2')
-
-# fail if the second file was started
-# before the first one was finished
-test.fail_test(start2 < finish1)
-
-test.pass_test()
- 

test/t0001.t

-#!/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()

test/t0002.py

-#!/usr/bin/env python
-
-__revision__ = "test/t0002.py __REVISION__ __DATE__ __DEVELOPER__"
-
-from TestCmd import TestCmd
-
-test = TestCmd(program = 'scons.py',
-               workdir = '',
-               interpreter = 'python')
-
-test.write('SConstruct', """
-env = Environment()
-env.Program(target = 'f1', source = 'f1.c')
-env.Program(target = 'f2', source = 'f2.c')
-env.Program(target = 'f3', source = 'f3.c')
-env.Program(target = 'f4', source = 'f4.c')
-""")
-
-test.write('f1.c', """
-int
-main(int argc, char *argv[])
-{
-    printf(\"f1.c\n\");
-    exit (0);
-}
-""")
-
-test.write('f2.c', """
-int
-main(int argc, char *argv[])
-{
-    printf(\"f2.c\n\");
-    exit (0);
-}
-""")
-
-
-test.write('f3.c', """
-int
-main(int argc, char *argv[])
-{
-    printf(\"f3.c\n\");
-    exit (0);
-}
-""")
-
-test.write('f4.c', """
-int
-main(int argc, char *argv[])
-{
-    printf(\"f4.c\n\");
-    exit (0);
-}
-""")
-
-
-test.run(chdir = '.', arguments = '-j 3 f1 f2 f3 f4')
-
-test.run(program = test.workpath('f1'))
-test.fail_test(test.stdout() != "f1.c\n")
-
-test.run(program = test.workpath('f2'))
-test.fail_test(test.stdout() != "f2.c\n")
-
-test.run(program = test.workpath('f3'))
-test.fail_test(test.stdout() != "f3.c\n")
-
-test.run(program = test.workpath('f4'))
-test.fail_test(test.stdout() != "f4.c\n")
-
-
-test.pass_test()

test/t0010.py

-#!/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', """
-env = Environment()
-env.Program(target = 'foo', source = 'foo.c')
-""")
-
-test.write('foo.c', """
-int
-main(int argc, char *argv[])
-{
-	printf("foo.c\n");
-	exit (0);
-}
-""")
-
-test.run(chdir = '.', arguments = 'foo')
-
-test.run(program = test.workpath('foo'))
-
-test.fail_test(test.stdout() != "foo.c\n")
-
-test.pass_test()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.