summaryrefslogtreecommitdiffstats
path: root/test/CacheDir
diff options
context:
space:
mode:
authorAdam Gross <grossag@vmware.com>2020-01-10 15:26:46 (GMT)
committerAdam Gross <grossag@vmware.com>2020-01-10 15:26:46 (GMT)
commit589b0a4a29353df1d1fe4177eae578fc6754f7ac (patch)
treedda3cdf00d2901ca60926ef47507a3c2aa3d2dc3 /test/CacheDir
parentd5ddf6ddf5c9a061ac0173e8887ce6e3e6bd5a30 (diff)
downloadSCons-589b0a4a29353df1d1fe4177eae578fc6754f7ac.zip
SCons-589b0a4a29353df1d1fe4177eae578fc6754f7ac.tar.gz
SCons-589b0a4a29353df1d1fe4177eae578fc6754f7ac.tar.bz2
Update and improve tests
This change integrates various review feedback, including: 1. Validates the result of Dir.get_contents() in PythonTests.py. 2. Adds a functional test for having value as a dependency.
Diffstat (limited to 'test/CacheDir')
-rw-r--r--test/CacheDir/value_dependencies.py (renamed from test/CacheDir/value.py)9
-rw-r--r--test/CacheDir/value_dependencies/SConstruct30
-rw-r--r--test/CacheDir/value_dependencies/testfile0
3 files changed, 37 insertions, 2 deletions
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