diff options
-rw-r--r-- | src/engine/SCons/Node/PythonTests.py | 3 | ||||
-rw-r--r-- | test/CacheDir/value_dependencies.py (renamed from test/CacheDir/value.py) | 9 | ||||
-rw-r--r-- | test/CacheDir/value_dependencies/SConstruct | 30 | ||||
-rw-r--r-- | test/CacheDir/value_dependencies/testfile | 0 | ||||
-rw-r--r-- | test/fixture/cachedir_foo_value/SConstruct | 19 | ||||
-rw-r--r-- | test/fixture/cachedir_foo_value/foo.c | 1 |
6 files changed, 39 insertions, 23 deletions
diff --git a/src/engine/SCons/Node/PythonTests.py b/src/engine/SCons/Node/PythonTests.py index 45248d3..da71074 100644 --- a/src/engine/SCons/Node/PythonTests.py +++ b/src/engine/SCons/Node/PythonTests.py @@ -120,7 +120,8 @@ class ValueChildTestCase(unittest.TestCase): node._func_get_contents = 2 # Pretend to be a Dir. node.add_to_implicit([value]) contents = node.get_contents() - assert len(contents) > 0 + expected_contents = '%s %s\n' % (value.get_csig(), value.name) + assert contents == expected_contents class ValueMemoTestCase(unittest.TestCase): diff --git a/test/CacheDir/value.py b/test/CacheDir/value_dependencies.py index fd89a9e..7992bef 100644 --- a/test/CacheDir/value.py +++ b/test/CacheDir/value_dependencies.py @@ -25,14 +25,19 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Verify that bwuilds with caching work for an action with a Value as a child. +Verify that bwuilds with caching work for an action with a Value as a child +in a variety of cases. Specifically: + +1. A source file that depends on a Value. +2. A source directory that depends on a Value. +3. A scanner that returns a Value and a directory that depends on a Value. """ import TestSCons test = TestSCons.TestSCons() -test.dir_fixture('cachedir_foo_value') +test.dir_fixture('value_dependencies') test.subdir('cache') # First build, populates the cache diff --git a/test/CacheDir/value_dependencies/SConstruct b/test/CacheDir/value_dependencies/SConstruct new file mode 100644 index 0000000..649648b --- /dev/null +++ b/test/CacheDir/value_dependencies/SConstruct @@ -0,0 +1,30 @@ +import SCons.Node + +CacheDir('cache') + +def b(target, source, env): + with open(target[0].abspath, 'w') as f: + pass + +def scan(node, env, path): + # Have the node depend on a directory, which depends on an instance of + # SCons.Node.Python.Value. + sample_dir = env.fs.Dir('dir2') + env.Depends(sample_dir, env.Value('c')) + return [sample_dir, env.Value('d')] + +scanner = Scanner(function=scan, node_class=SCons.Node.Node) +builder = Builder(action=b, source_scanner=scanner) + +env = Environment() +env.Append(BUILDERS={'B': builder}) + +# Create a node and a directory that each depend on an instance of +# SCons.Node.Python.Value. +sample_dir = env.fs.Dir('dir1') +env.Depends(sample_dir, env.Value('a')) + +sample_file = env.fs.File('testfile') +env.Depends(sample_file, env.Value('b')) + +env.B(target='File1.out', source=[sample_dir, sample_file]) diff --git a/test/CacheDir/value_dependencies/testfile b/test/CacheDir/value_dependencies/testfile new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/CacheDir/value_dependencies/testfile diff --git a/test/fixture/cachedir_foo_value/SConstruct b/test/fixture/cachedir_foo_value/SConstruct deleted file mode 100644 index b144799..0000000 --- a/test/fixture/cachedir_foo_value/SConstruct +++ /dev/null @@ -1,19 +0,0 @@ -import SCons.Node - -CacheDir('cache') - -def b(target, source, env): - with open(target[0].abspath, 'w') as f: - pass - -def scan(node, env, path): - return [env.Value('a')] - -scanner = Scanner(function=scan, node_class=SCons.Node.Node) -builder = Builder(action=b, source_scanner=scanner) - -env = Environment() -env.Append(BUILDERS={'B': builder}) - -env.B(target='File1.out', source='foo.c') -#env.Program('foo', foo_c) diff --git a/test/fixture/cachedir_foo_value/foo.c b/test/fixture/cachedir_foo_value/foo.c deleted file mode 100644 index 5ab8d0f..0000000 --- a/test/fixture/cachedir_foo_value/foo.c +++ /dev/null @@ -1 +0,0 @@ -int main(void){ return 0; } |