summaryrefslogtreecommitdiffstats
path: root/test/sconsign
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2022-05-13 14:18:22 (GMT)
committerMats Wichmann <mats@linux.com>2022-05-31 14:42:08 (GMT)
commitc7272c7367f1c3f819645d996c6d93449cf14f5b (patch)
tree0f62d0d49d2de994a3972426f31d39b2aa9e1fd1 /test/sconsign
parentf2eccd82e6b63a4c31ab2797d7f5368a23010295 (diff)
downloadSCons-c7272c7367f1c3f819645d996c6d93449cf14f5b.zip
SCons-c7272c7367f1c3f819645d996c6d93449cf14f5b.tar.gz
SCons-c7272c7367f1c3f819645d996c6d93449cf14f5b.tar.bz2
Normalize use of test.sleep()
Some tests used time.sleep while others used the harness's test.sleep, the ones that are done for file timestamp delay management now all use test.sleep - with a consistent comment, so it's easier to spot. There are still tests that use time.sleep with smaller intervals that were left alone. Affected tests were reformatted, in the spirit of gradually improving tests that you otherwise touch... Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/sconsign')
-rw-r--r--test/sconsign/script/Signatures.py26
-rw-r--r--test/sconsign/script/dblite.py45
2 files changed, 33 insertions, 38 deletions
diff --git a/test/sconsign/script/Signatures.py b/test/sconsign/script/Signatures.py
index ef8bac0..2225f83 100644
--- a/test/sconsign/script/Signatures.py
+++ b/test/sconsign/script/Signatures.py
@@ -44,8 +44,8 @@ if NEED_HELPER:
# in the expected output because paths in the .sconsign files are
# canonicalized to use / as the separator.
-sub1_hello_c = 'sub1/hello.c'
-sub1_hello_obj = 'sub1/hello.obj'
+sub1_hello_c = 'sub1/hello.c'
+sub1_hello_obj = 'sub1/hello.obj'
test.subdir('sub1', 'sub2')
@@ -135,7 +135,7 @@ env2.Program('sub2/hello.c')
""",
)
# TODO in the above, we would normally want to run a python program
-# using "our python" like this:
+# using "our Python" like this:
# CCCOM=[[r'{_python_}', r'{fake_cc_py}', 'sub2', '$TARGET', '$SOURCE']],
# LINKCOM=[[r'{_python_}', r'{fake_link_py}', '$TARGET', '$SOURCE']],
# however we're looking at dependencies with sconsign, so that breaks things.
@@ -160,17 +160,16 @@ test.write(['sub2', 'inc2.h'], r"""\
#define STRING2 "inc2.h"
""")
-test.sleep()
-
+test.sleep() # delay for timestamps
test.run(arguments = '. --max-drift=1')
sig_re = r'[0-9a-fA-F]{32,64}'
date_re = r'\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d'
-
database_name = test.get_sconsignname()
-test.run_sconsign(arguments = f"-e hello.exe -e hello.obj sub1/{database_name}",
- stdout = r"""hello.exe: %(sig_re)s \d+ \d+
+test.run_sconsign(
+ arguments=f"-e hello.exe -e hello.obj sub1/{database_name}",
+ stdout=r"""hello.exe: %(sig_re)s \d+ \d+
%(sub1_hello_obj)s: %(sig_re)s \d+ \d+
fake_link\.py: None \d+ \d+
%(sig_re)s \[.*\]
@@ -178,10 +177,12 @@ hello.obj: %(sig_re)s \d+ \d+
%(sub1_hello_c)s: None \d+ \d+
fake_cc\.py: None \d+ \d+
%(sig_re)s \[.*\]
-""" % locals())
+""" % locals(),
+)
-test.run_sconsign(arguments = f"-e hello.exe -e hello.obj -r sub1/{database_name}",
- stdout = r"""hello.exe: %(sig_re)s '%(date_re)s' \d+
+test.run_sconsign(
+ arguments=f"-e hello.exe -e hello.obj -r sub1/{database_name}",
+ stdout=r"""hello.exe: %(sig_re)s '%(date_re)s' \d+
%(sub1_hello_obj)s: %(sig_re)s '%(date_re)s' \d+
fake_link\.py: None '%(date_re)s' \d+
%(sig_re)s \[.*\]
@@ -189,7 +190,8 @@ hello.obj: %(sig_re)s '%(date_re)s' \d+
%(sub1_hello_c)s: None '%(date_re)s' \d+
fake_cc\.py: None '%(date_re)s' \d+
%(sig_re)s \[.*\]
-""" % locals())
+""" % locals(),
+)
test.pass_test()
diff --git a/test/sconsign/script/dblite.py b/test/sconsign/script/dblite.py
index 1fcf8c0..24d8403 100644
--- a/test/sconsign/script/dblite.py
+++ b/test/sconsign/script/dblite.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Verify that various ways of getting at a an sconsign file written with
@@ -97,17 +96,11 @@ main(int argc, char *argv[])
}
""")
-test.write(['sub2', 'inc1.h'], r"""\
-#define STRING1 "inc1.h"
-""")
-
-test.write(['sub2', 'inc2.h'], r"""\
-#define STRING2 "inc2.h"
-""")
-
-test.sleep()
+test.write(['sub2', 'inc1.h'], r'#define STRING1 "inc1.h"')
+test.write(['sub2', 'inc2.h'], r'#define STRING2 "inc2.h"')
-test.run(arguments = '. --max-drift=1')
+test.sleep() # delay for timestamps
+test.run(arguments='. --max-drift=1')
sig_re = r'[0-9a-fA-F]{32,64}'
date_re = r'\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d'
@@ -146,23 +139,23 @@ hello%(_obj)s: %(sig_re)s '%(date_re)s' \d+
common_flags = '-e hello%(_exe)s -e hello%(_obj)s -d sub1' % locals()
-test.run_sconsign(arguments = "%s my_sconsign" % common_flags,
- stdout = expect)
+test.run_sconsign(arguments="%s my_sconsign" % common_flags, stdout=expect)
-test.run_sconsign(arguments = "%s my_sconsign.dblite" % common_flags,
- stdout = expect)
+test.run_sconsign(arguments="%s my_sconsign.dblite" % common_flags, stdout=expect)
-test.run_sconsign(arguments = "%s -f dblite my_sconsign" % common_flags,
- stdout = expect)
+test.run_sconsign(arguments="%s -f dblite my_sconsign" % common_flags, stdout=expect)
-test.run_sconsign(arguments = "%s -f dblite my_sconsign.dblite" % common_flags,
- stdout = expect)
+test.run_sconsign(
+ arguments="%s -f dblite my_sconsign.dblite" % common_flags, stdout=expect
+)
-test.run_sconsign(arguments = "%s -r -f dblite my_sconsign" % common_flags,
- stdout = expect_r)
+test.run_sconsign(
+ arguments="%s -r -f dblite my_sconsign" % common_flags, stdout=expect_r
+)
-test.run_sconsign(arguments = "%s -r -f dblite my_sconsign.dblite" % common_flags,
- stdout = expect_r)
+test.run_sconsign(
+ arguments="%s -r -f dblite my_sconsign.dblite" % common_flags, stdout=expect_r
+)
test.pass_test()