diff options
Diffstat (limited to 'test/sconsign/script/SConsignFile.py')
-rw-r--r-- | test/sconsign/script/SConsignFile.py | 98 |
1 files changed, 48 insertions, 50 deletions
diff --git a/test/sconsign/script/SConsignFile.py b/test/sconsign/script/SConsignFile.py index 71c91cb..89d562a 100644 --- a/test/sconsign/script/SConsignFile.py +++ b/test/sconsign/script/SConsignFile.py @@ -35,19 +35,14 @@ 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""" +fake_cc_py = test.workpath('fake_cc.py') +fake_link_py = test.workpath('fake_link.py') + +test.write(fake_cc_py, r"""#!/usr/bin/env python import os import re import string @@ -80,7 +75,7 @@ process(input, output) sys.exit(0) """) -test.write('fake_link.py', r""" +test.write(fake_link_py, r"""#!/usr/bin/env python import sys output = open(sys.argv[1], 'wb') @@ -93,6 +88,9 @@ output.write(input.read()) sys.exit(0) """) +test.chmod(fake_cc_py, 0755) +test.chmod(fake_link_py, 0755) + # Note: We don't use os.path.join() representations of the file names # in the expected output because paths in the .sconsign files are # canonicalized to use / as the separator. @@ -108,8 +106,8 @@ test.write(['SConstruct'], """\ SConsignFile() env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj', - CCCOM = r'%(_python_)s fake_cc.py sub2 $TARGET $SOURCE', - LINKCOM = r'%(_python_)s fake_link.py $TARGET $SOURCE') + CCCOM = [[r'%(fake_cc_py)s', 'sub2', '$TARGET', '$SOURCE']], + LINKCOM = [[r'%(fake_link_py)s', '$TARGET', '$SOURCE']]) env1.PrependENVPath('PATHEXT', '.PY') env1.Program('sub1/hello.c') env2 = env1.Clone(CPPPATH = ['sub2']) @@ -147,29 +145,29 @@ sig_re = r'[0-9a-fA-F]{32}' test.run_sconsign(arguments = ".sconsign", stdout = r"""=== .: SConstruct: None \d+ \d+ -=== %(python_dir_re)s: -%(python_file_re)s: %(sig_re)s \d+ \d+ +fake_cc\.py: %(sig_re)s \d+ \d+ +fake_link\.py: %(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+ + fake_link\.py: %(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+ + fake_cc\.py: %(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+ + fake_link\.py: %(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+ + fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] inc1.h: %(sig_re)s \d+ \d+ inc2.h: %(sig_re)s \d+ \d+ @@ -178,29 +176,29 @@ 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} +fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} +fake_link\.py: {'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} + fake_link\.py: {'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} + fake_cc\.py: {'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} + fake_link\.py: {'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} + fake_cc\.py: {'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} @@ -211,8 +209,11 @@ SConstruct: csig: None timestamp: \d+ size: \d+ -=== %(python_dir_re)s: -%(python_file_re)s: +fake_cc\.py: + csig: %(sig_re)s + timestamp: \d+ + size: \d+ +fake_link\.py: csig: %(sig_re)s timestamp: \d+ size: \d+ @@ -230,7 +231,7 @@ hello.exe: csig: %(sig_re)s timestamp: \d+ size: \d+ - %(python_re)s: + fake_link\.py: csig: %(sig_re)s timestamp: \d+ size: \d+ @@ -244,7 +245,7 @@ hello.obj: csig: %(sig_re)s timestamp: \d+ size: \d+ - %(python_re)s: + fake_cc\.py: csig: %(sig_re)s timestamp: \d+ size: \d+ @@ -263,7 +264,7 @@ hello.exe: csig: %(sig_re)s timestamp: \d+ size: \d+ - %(python_re)s: + fake_link\.py: csig: %(sig_re)s timestamp: \d+ size: \d+ @@ -285,7 +286,7 @@ hello.obj: csig: %(sig_re)s timestamp: \d+ size: \d+ - %(python_re)s: + fake_cc\.py: csig: %(sig_re)s timestamp: \d+ size: \d+ @@ -306,8 +307,9 @@ test.run_sconsign(arguments = "-c -v .sconsign", stdout = r"""=== .: SConstruct: csig: None -=== %(python_dir_re)s: -%(python_file_re)s: +fake_cc\.py: + csig: %(sig_re)s +fake_link\.py: csig: %(sig_re)s === sub1: hello.c: @@ -333,8 +335,9 @@ test.run_sconsign(arguments = "-s -v .sconsign", stdout = r"""=== .: SConstruct: size: \d+ -=== %(python_dir_re)s: -%(python_file_re)s: +fake_cc\.py: + size: \d+ +fake_link\.py: size: \d+ === sub1: hello.c: @@ -360,8 +363,9 @@ test.run_sconsign(arguments = "-t -v .sconsign", stdout = r"""=== .: SConstruct: timestamp: \d+ -=== %(python_dir_re)s: -%(python_file_re)s: +fake_cc\.py: + timestamp: \d+ +fake_link\.py: timestamp: \d+ === sub1: hello.c: @@ -385,64 +389,58 @@ inc2.h: 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+ + fake_cc\.py: %(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+ + fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] """ % locals(), 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+ + fake_cc\.py: %(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+ + fake_link\.py: %(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+ + fake_cc\.py: %(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+ + fake_cc\.py: %(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+ + fake_link\.py: %(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+ + fake_cc\.py: %(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 `\.' -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", |