Anonymous avatar Anonymous committed 14d6839

Update tests for now discovering dependencies on quoted commands
in command lines.

Comments (0)

Files changed (4)

test/explain/basic.py

 Verify a lot of the basic operation of the --debug=explain option.
 """
 
-import os.path
+import os
 import string
 import sys
 import TestSCons
 
+python = TestSCons.python
 _python_ = TestSCons._python_
 
 test = TestSCons.TestSCons()
 
 expect = test.wrap_stdout("""\
 scons: rebuilding `file3' because the dependency order changed:
-               old: ['xxx', 'yyy', 'zzz']
-               new: ['zzz', 'yyy', 'xxx']
+               old: ['xxx', 'yyy', 'zzz', '%(python)s']
+               new: ['zzz', 'yyy', 'xxx', '%(python)s']
 %(_python_)s %(cat_py)s file3 zzz yyy xxx
 """ % locals())
 

test/sconsign/script/SConsignFile.py

 using the signatures in an SConsignFile().
 """
 
+import os
+import re
+
 import TestSCons
 import TestSConsign
 
+python = TestSCons.python
+python_dir, python_file = os.path.split(python)
 _python_ = TestSCons._python_
 
+python_re = re.escape(python)
+python_dir_re = re.escape(python_dir)
+python_file_re = re.escape(python_file)
+
 test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
 
 test.subdir('sub1', 'sub2')
 
 test.write('fake_cc.py', r"""
-import os.path
+import os
 import re
 import string
 import sys
 test.run_sconsign(arguments = ".sconsign",
          stdout = r"""=== .:
 SConstruct: None \d+ \d+
+=== %(python_dir_re)s:
+%(python_file_re)s: %(sig_re)s \d+ \d+
 === sub1:
 hello.c: %(sig_re)s \d+ \d+
 hello.exe: %(sig_re)s \d+ \d+
         %(sub1_hello_obj)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.obj: %(sig_re)s \d+ \d+
         %(sub1_hello_c)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 === sub2:
 hello.c: %(sig_re)s \d+ \d+
 hello.exe: %(sig_re)s \d+ \d+
         %(sub2_hello_obj)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.obj: %(sig_re)s \d+ \d+
         %(sub2_hello_c)s: %(sig_re)s \d+ \d+
         %(sub2_inc1_h)s: %(sig_re)s \d+ \d+
         %(sub2_inc2_h)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 inc1.h: %(sig_re)s \d+ \d+
 inc2.h: %(sig_re)s \d+ \d+
 test.run_sconsign(arguments = "--raw .sconsign",
          stdout = r"""=== .:
 SConstruct: {'csig': None, 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
+=== %(python_dir_re)s:
+%(python_file_re)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
 === sub1:
 hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
 hello.exe: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sub1_hello_obj)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
+        %(python_re)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sig_re)s \[.*\]
 hello.obj: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sub1_hello_c)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
+        %(python_re)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sig_re)s \[.*\]
 === sub2:
 hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
 hello.exe: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sub2_hello_obj)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
+        %(python_re)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sig_re)s \[.*\]
 hello.obj: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sub2_hello_c)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sub2_inc1_h)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sub2_inc2_h)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
+        %(python_re)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sig_re)s \[.*\]
 inc1.h: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
 inc2.h: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
     csig: None
     timestamp: \d+
     size: \d+
+=== %(python_dir_re)s:
+%(python_file_re)s:
+    csig: %(sig_re)s
+    timestamp: \d+
+    size: \d+
 === sub1:
 hello.c:
     csig: %(sig_re)s
             csig: %(sig_re)s
             timestamp: \d+
             size: \d+
+        %(python_re)s:
+            csig: %(sig_re)s
+            timestamp: \d+
+            size: \d+
     action: %(sig_re)s \[.*\]
 hello.obj:
     csig: %(sig_re)s
             csig: %(sig_re)s
             timestamp: \d+
             size: \d+
+        %(python_re)s:
+            csig: %(sig_re)s
+            timestamp: \d+
+            size: \d+
     action: %(sig_re)s \[.*\]
 === sub2:
 hello.c:
             csig: %(sig_re)s
             timestamp: \d+
             size: \d+
+        %(python_re)s:
+            csig: %(sig_re)s
+            timestamp: \d+
+            size: \d+
     action: %(sig_re)s \[.*\]
 hello.obj:
     csig: %(sig_re)s
             csig: %(sig_re)s
             timestamp: \d+
             size: \d+
+        %(python_re)s:
+            csig: %(sig_re)s
+            timestamp: \d+
+            size: \d+
     action: %(sig_re)s \[.*\]
 inc1.h:
     csig: %(sig_re)s
          stdout = r"""=== .:
 SConstruct:
     csig: None
+=== %(python_dir_re)s:
+%(python_file_re)s:
+    csig: %(sig_re)s
 === sub1:
 hello.c:
     csig: %(sig_re)s
          stdout = r"""=== .:
 SConstruct:
     size: \d+
+=== %(python_dir_re)s:
+%(python_file_re)s:
+    size: \d+
 === sub1:
 hello.c:
     size: \d+
          stdout = r"""=== .:
 SConstruct:
     timestamp: \d+
+=== %(python_dir_re)s:
+%(python_file_re)s:
+    timestamp: \d+
 === sub1:
 hello.c:
     timestamp: \d+
 
 test.run_sconsign(arguments = "-e hello.obj .sconsign",
          stdout = r"""=== .:
+=== %(python_dir_re)s:
 === sub1:
 hello.obj: %(sig_re)s \d+ \d+
         %(sub1_hello_c)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 === sub2:
 hello.obj: %(sig_re)s \d+ \d+
         %(sub2_hello_c)s: %(sig_re)s \d+ \d+
         %(sub2_inc1_h)s: %(sig_re)s \d+ \d+
         %(sub2_inc2_h)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 """ % locals(),
-         stderr = r"""sconsign: no entry `hello.obj' in `\.'
-""")
+         stderr = r"""sconsign: no entry `hello\.obj' in `\.'
+sconsign: no entry `hello\.obj' in `%(python_dir_re)s'
+""" % locals())
 
 test.run_sconsign(arguments = "-e hello.obj -e hello.exe -e hello.obj .sconsign",
          stdout = r"""=== .:
+=== %(python_dir_re)s:
 === sub1:
 hello.obj: %(sig_re)s \d+ \d+
         %(sub1_hello_c)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.exe: %(sig_re)s \d+ \d+
         %(sub1_hello_obj)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.obj: %(sig_re)s \d+ \d+
         %(sub1_hello_c)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 === sub2:
 hello.obj: %(sig_re)s \d+ \d+
         %(sub2_hello_c)s: %(sig_re)s \d+ \d+
         %(sub2_inc1_h)s: %(sig_re)s \d+ \d+
         %(sub2_inc2_h)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.exe: %(sig_re)s \d+ \d+
         %(sub2_hello_obj)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.obj: %(sig_re)s \d+ \d+
         %(sub2_hello_c)s: %(sig_re)s \d+ \d+
         %(sub2_inc1_h)s: %(sig_re)s \d+ \d+
         %(sub2_inc2_h)s: %(sig_re)s \d+ \d+
+        %(python_re)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 """ % locals(),
-        stderr = r"""sconsign: no entry `hello.obj' in `\.'
-sconsign: no entry `hello.exe' in `\.'
-sconsign: no entry `hello.obj' in `\.'
+        stderr = r"""sconsign: no entry `hello\.obj' in `\.'
+sconsign: no entry `hello\.exe' in `\.'
+sconsign: no entry `hello\.obj' in `\.'
+sconsign: no entry `hello\.obj' in `%(python_dir_re)s'
+sconsign: no entry `hello\.exe' in `%(python_dir_re)s'
+sconsign: no entry `hello\.obj' in `%(python_dir_re)s'
 """ % locals())
 
 #test.run_sconsign(arguments = "-i -v .sconsign",

test/sconsign/script/Signatures.py

 import TestSCons
 import TestSConsign
 
+python = TestSCons.python
 _python_ = TestSCons._python_
 
 test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
 test.subdir('sub1', 'sub2')
 
 test.write('fake_cc.py', r"""
-import os.path
+import os
 import re
 import string
 import sys
 test.run_sconsign(arguments = "-e hello.exe -e hello.obj sub1/.sconsign",
          stdout = r"""hello.exe: %(sig_re)s \d+ \d+
         %(sub1_hello_obj)s: %(sig_re)s \d+ \d+
+        %(python)s: None \d+ \d+
         %(sig_re)s \[.*\]
 hello.obj: %(sig_re)s \d+ \d+
         %(sub1_hello_c)s: None \d+ \d+
+        %(python)s: None \d+ \d+
         %(sig_re)s \[.*\]
 """ % locals())
 
 test.run_sconsign(arguments = "-e hello.exe -e hello.obj -r sub1/.sconsign",
          stdout = r"""hello.exe: %(sig_re)s '%(date_re)s' \d+
         %(sub1_hello_obj)s: %(sig_re)s '%(date_re)s' \d+
+        %(python)s: None '%(date_re)s' \d+
         %(sig_re)s \[.*\]
 hello.obj: %(sig_re)s '%(date_re)s' \d+
         %(sub1_hello_c)s: None '%(date_re)s' \d+
+        %(python)s: None '%(date_re)s' \d+
         %(sig_re)s \[.*\]
 """ % locals())
 

test/sconsign/script/no-SConsignFile.py

 import TestSCons
 import TestSConsign
 
+python = TestSCons.python
 _python_ = TestSCons._python_
 
 test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
 test.subdir('sub1', 'sub2')
 
 test.write('fake_cc.py', r"""
-import os.path
+import os
 import re
 import string
 import sys
 expect = r"""hello.c: %(sig_re)s \d+ \d+
 hello.exe: %(sig_re)s \d+ \d+
         %(sub1_hello_obj)s: %(sig_re)s \d+ \d+
+        %(python)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.obj: %(sig_re)s \d+ \d+
         %(sub1_hello_c)s: %(sig_re)s \d+ \d+
+        %(python)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 """ % locals()
 
          stdout = r"""hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
 hello.exe: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sub1_hello_obj)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
+        %(python)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sig_re)s \[.*\]
 hello.obj: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sub1_hello_c)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
+        %(python)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1}
         %(sig_re)s \[.*\]
 """ % locals())
 
             csig: %(sig_re)s
             timestamp: \d+
             size: \d+
+        %(python)s:
+            csig: %(sig_re)s
+            timestamp: \d+
+            size: \d+
     action: %(sig_re)s \[.*\]
 hello.obj:
     csig: %(sig_re)s
             csig: %(sig_re)s
             timestamp: \d+
             size: \d+
+        %(python)s:
+            csig: %(sig_re)s
+            timestamp: \d+
+            size: \d+
     action: %(sig_re)s \[.*\]
 """ % locals())
 
 test.run_sconsign(arguments = "-e hello.obj sub1/.sconsign",
          stdout = r"""hello.obj: %(sig_re)s \d+ \d+
         %(sub1_hello_c)s: %(sig_re)s \d+ \d+
+        %(python)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 """ % locals())
 
 test.run_sconsign(arguments = "-e hello.obj -e hello.exe -e hello.obj sub1/.sconsign",
          stdout = r"""hello.obj: %(sig_re)s \d+ \d+
         %(sub1_hello_c)s: %(sig_re)s \d+ \d+
+        %(python)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.exe: %(sig_re)s \d+ \d+
         %(sub1_hello_obj)s: %(sig_re)s \d+ \d+
+        %(python)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.obj: %(sig_re)s \d+ \d+
         %(sub1_hello_c)s: %(sig_re)s \d+ \d+
+        %(python)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 """ % locals())
 
          stdout = r"""hello.c: %(sig_re)s \d+ \d+
 hello.exe: %(sig_re)s \d+ \d+
         %(sub2_hello_obj)s: %(sig_re)s \d+ \d+
+        %(python)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.obj: %(sig_re)s \d+ \d+
         %(sub2_hello_c)s: %(sig_re)s \d+ \d+
         %(sub2_inc1_h)s: %(sig_re)s \d+ \d+
         %(sub2_inc2_h)s: %(sig_re)s \d+ \d+
+        %(python)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 inc1.h: %(sig_re)s \d+ \d+
 inc2.h: %(sig_re)s \d+ \d+
         %(sub2_hello_c)s: %(sig_re)s \d+ \d+
         %(sub2_inc1_h)s: %(sig_re)s \d+ \d+
         %(sub2_inc2_h)s: %(sig_re)s \d+ \d+
+        %(python)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 hello.obj: %(sig_re)s \d+ \d+
         %(sub1_hello_c)s: %(sig_re)s \d+ \d+
+        %(python)s: %(sig_re)s \d+ \d+
         %(sig_re)s \[.*\]
 """ % locals())
 
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.