Skip to content

Commit

Permalink
Adjust sconsign tests for float timestamps
Browse files Browse the repository at this point in the history
If a stat_result object's st_*time attributes are used, a float is
returned instead of an int. Adjust sconsign test regexes to optionally
accept a .digits tail of the number.  Confirmed this works for both
indexed attributes (which return an int) and named attributes (float).

Signed-off-by: Mats Wichmann <[email protected]>
  • Loading branch information
mwichmann committed Dec 15, 2024
1 parent 9d5e76a commit 70e8cf9
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 193 deletions.
6 changes: 3 additions & 3 deletions test/sconsign/script/Configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@
# Value node being printed actually begins with a newline. It would
# probably be good to change that to a repr() of the contents.
expect = r"""=== .:
SConstruct: None \d+ \d+
SConstruct: None \d+(\.\d*)? \d+
=== .sconf_temp:
conftest_%(sig_re)s_0.c:
'.*':
'.*':\s
#include "math.h"
%(sig_re)s \[.*\]
conftest_%(sig_re)s_0_%(sig_re)s%(_obj)s:
%(_sconf_temp_conftest_0_c)s: %(sig_re)s \d+ \d+
%(_sconf_temp_conftest_0_c)s: %(sig_re)s \d+(\.\d*)? \d+
%(CC)s: %(sig_re)s None None
%(sig_re)s \[.*\]
=== %(CC_dir)s:
Expand Down
208 changes: 104 additions & 104 deletions test/sconsign/script/SConsignFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,160 +164,160 @@ def process(infp, outfp):

test.run_sconsign(arguments=database_name,
stdout=r"""=== .:
SConstruct: None \d+ \d+
fake_cc\.py: %(sig_re)s \d+ \d+
fake_link\.py: %(sig_re)s \d+ \d+
SConstruct: None \d+(\.\d*)? \d+
fake_cc\.py: %(sig_re)s \d+(\.\d*)? \d+
fake_link\.py: %(sig_re)s \d+(\.\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+
fake_link\.py: %(sig_re)s \d+ \d+
hello.c: %(sig_re)s \d+(\.\d*)? \d+
hello.exe: %(sig_re)s \d+(\.\d*)? \d+
%(sub1_hello_obj)s: %(sig_re)s \d+(\.\d*)? \d+
fake_link\.py: %(sig_re)s \d+(\.\d*)? \d+
%(sig_re)s \[.*\]
hello.obj: %(sig_re)s \d+ \d+
%(sub1_hello_c)s: %(sig_re)s \d+ \d+
fake_cc\.py: %(sig_re)s \d+ \d+
hello.obj: %(sig_re)s \d+(\.\d*)? \d+
%(sub1_hello_c)s: %(sig_re)s \d+(\.\d*)? \d+
fake_cc\.py: %(sig_re)s \d+(\.\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+
fake_link\.py: %(sig_re)s \d+ \d+
hello.c: %(sig_re)s \d+(\.\d*)? \d+
hello.exe: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_hello_obj)s: %(sig_re)s \d+(\.\d*)? \d+
fake_link\.py: %(sig_re)s \d+(\.\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+
fake_cc\.py: %(sig_re)s \d+ \d+
hello.obj: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_hello_c)s: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_inc1_h)s: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_inc2_h)s: %(sig_re)s \d+(\.\d*)? \d+
fake_cc\.py: %(sig_re)s \d+(\.\d*)? \d+
%(sig_re)s \[.*\]
inc1.h: %(sig_re)s \d+ \d+
inc2.h: %(sig_re)s \d+ \d+
inc1.h: %(sig_re)s \d+(\.\d*)? \d+
inc2.h: %(sig_re)s \d+(\.\d*)? \d+
""" % locals())

test.run_sconsign(arguments="--raw " + database_name,
stdout=r"""=== .:
SConstruct: {'csig': None, 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
fake_link\.py: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
SConstruct: {'csig': None, 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
fake_link\.py: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
=== sub1:
hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
hello.exe: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
%(sub1_hello_obj)s: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
fake_link\.py: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
hello.exe: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
%(sub1_hello_obj)s: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
fake_link\.py: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
%(sig_re)s \[.*\]
hello.obj: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
%(sub1_hello_c)s: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
hello.obj: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
%(sub1_hello_c)s: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
%(sig_re)s \[.*\]
=== sub2:
hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
hello.exe: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
%(sub2_hello_obj)s: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
fake_link\.py: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
hello.exe: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
%(sub2_hello_obj)s: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
fake_link\.py: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
%(sig_re)s \[.*\]
hello.obj: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
%(sub2_hello_c)s: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
%(sub2_inc1_h)s: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
%(sub2_inc2_h)s: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
hello.obj: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
%(sub2_hello_c)s: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
%(sub2_inc1_h)s: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
%(sub2_inc2_h)s: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
%(sig_re)s \[.*\]
inc1.h: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
inc2.h: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2}
inc1.h: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
inc2.h: {'csig': '%(sig_re)s', 'timestamp': \d+(\.\d*)?L?, 'size': \d+L?, '_version_id': 2}
""" % locals())

expect = r"""=== .:
SConstruct:
csig: None
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
fake_cc\.py:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
fake_link\.py:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
=== sub1:
hello.c:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
hello.exe:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
implicit:
%(sub1_hello_obj)s:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
fake_link\.py:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
action: %(sig_re)s \[.*\]
hello.obj:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
implicit:
%(sub1_hello_c)s:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
fake_cc\.py:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
action: %(sig_re)s \[.*\]
=== sub2:
hello.c:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
hello.exe:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
implicit:
%(sub2_hello_obj)s:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
fake_link\.py:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
action: %(sig_re)s \[.*\]
hello.obj:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
implicit:
%(sub2_hello_c)s:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
%(sub2_inc1_h)s:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
%(sub2_inc2_h)s:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
fake_cc\.py:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
action: %(sig_re)s \[.*\]
inc1.h:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
inc2.h:
csig: %(sig_re)s
timestamp: \d+
timestamp: \d+(\.\d*)?
size: \d+
""" % locals()

Expand Down Expand Up @@ -382,44 +382,44 @@ def process(infp, outfp):
test.run_sconsign(arguments="-t -v " + database_name,
stdout=r"""=== .:
SConstruct:
timestamp: \d+
timestamp: \d+(\.\d*)?
fake_cc\.py:
timestamp: \d+
timestamp: \d+(\.\d*)?
fake_link\.py:
timestamp: \d+
timestamp: \d+(\.\d*)?
=== sub1:
hello.c:
timestamp: \d+
timestamp: \d+(\.\d*)?
hello.exe:
timestamp: \d+
timestamp: \d+(\.\d*)?
hello.obj:
timestamp: \d+
timestamp: \d+(\.\d*)?
=== sub2:
hello.c:
timestamp: \d+
timestamp: \d+(\.\d*)?
hello.exe:
timestamp: \d+
timestamp: \d+(\.\d*)?
hello.obj:
timestamp: \d+
timestamp: \d+(\.\d*)?
inc1.h:
timestamp: \d+
timestamp: \d+(\.\d*)?
inc2.h:
timestamp: \d+
timestamp: \d+(\.\d*)?
""")

test.run_sconsign(arguments="-e hello.obj " + database_name,
stdout=r"""=== .:
=== sub1:
hello.obj: %(sig_re)s \d+ \d+
%(sub1_hello_c)s: %(sig_re)s \d+ \d+
fake_cc\.py: %(sig_re)s \d+ \d+
hello.obj: %(sig_re)s \d+(\.\d*)? \d+
%(sub1_hello_c)s: %(sig_re)s \d+(\.\d*)? \d+
fake_cc\.py: %(sig_re)s \d+(\.\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+
fake_cc\.py: %(sig_re)s \d+ \d+
hello.obj: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_hello_c)s: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_inc1_h)s: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_inc2_h)s: %(sig_re)s \d+(\.\d*)? \d+
fake_cc\.py: %(sig_re)s \d+(\.\d*)? \d+
%(sig_re)s \[.*\]
""" % locals(),
stderr=r"""sconsign: no entry `hello\.obj' in `\.'
Expand All @@ -428,34 +428,34 @@ def process(infp, outfp):
test.run_sconsign(arguments="-e hello.obj -e hello.exe -e hello.obj " + database_name,
stdout=r"""=== .:
=== sub1:
hello.obj: %(sig_re)s \d+ \d+
%(sub1_hello_c)s: %(sig_re)s \d+ \d+
fake_cc\.py: %(sig_re)s \d+ \d+
hello.obj: %(sig_re)s \d+(\.\d*)? \d+
%(sub1_hello_c)s: %(sig_re)s \d+(\.\d*)? \d+
fake_cc\.py: %(sig_re)s \d+(\.\d*)? \d+
%(sig_re)s \[.*\]
hello.exe: %(sig_re)s \d+ \d+
%(sub1_hello_obj)s: %(sig_re)s \d+ \d+
fake_link\.py: %(sig_re)s \d+ \d+
hello.exe: %(sig_re)s \d+(\.\d*)? \d+
%(sub1_hello_obj)s: %(sig_re)s \d+(\.\d*)? \d+
fake_link\.py: %(sig_re)s \d+(\.\d*)? \d+
%(sig_re)s \[.*\]
hello.obj: %(sig_re)s \d+ \d+
%(sub1_hello_c)s: %(sig_re)s \d+ \d+
fake_cc\.py: %(sig_re)s \d+ \d+
hello.obj: %(sig_re)s \d+(\.\d*)? \d+
%(sub1_hello_c)s: %(sig_re)s \d+(\.\d*)? \d+
fake_cc\.py: %(sig_re)s \d+(\.\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+
fake_cc\.py: %(sig_re)s \d+ \d+
hello.obj: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_hello_c)s: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_inc1_h)s: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_inc2_h)s: %(sig_re)s \d+(\.\d*)? \d+
fake_cc\.py: %(sig_re)s \d+(\.\d*)? \d+
%(sig_re)s \[.*\]
hello.exe: %(sig_re)s \d+ \d+
%(sub2_hello_obj)s: %(sig_re)s \d+ \d+
fake_link\.py: %(sig_re)s \d+ \d+
hello.exe: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_hello_obj)s: %(sig_re)s \d+(\.\d*)? \d+
fake_link\.py: %(sig_re)s \d+(\.\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+
fake_cc\.py: %(sig_re)s \d+ \d+
hello.obj: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_hello_c)s: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_inc1_h)s: %(sig_re)s \d+(\.\d*)? \d+
%(sub2_inc2_h)s: %(sig_re)s \d+(\.\d*)? \d+
fake_cc\.py: %(sig_re)s \d+(\.\d*)? \d+
%(sig_re)s \[.*\]
""" % locals(),
stderr=r"""sconsign: no entry `hello\.obj' in `\.'
Expand Down
Loading

0 comments on commit 70e8cf9

Please sign in to comment.