mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 15:39:07 +00:00
Compute touch timestamps in Python
This commit is contained in:
parent
50801485f0
commit
2db9f22aac
@ -9,6 +9,7 @@ import pqclean
|
|||||||
import helpers
|
import helpers
|
||||||
import subprocess
|
import subprocess
|
||||||
import glob
|
import glob
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
def test_makefile_dependencies():
|
def test_makefile_dependencies():
|
||||||
@ -35,15 +36,18 @@ def check_makefile_dependencies(scheme_name, implementation_name, file):
|
|||||||
|
|
||||||
# modification time-based calculations is tricky on a sub-second basis
|
# modification time-based calculations is tricky on a sub-second basis
|
||||||
# so we reset all the modification times to a known and "sensible" order
|
# so we reset all the modification times to a known and "sensible" order
|
||||||
helpers.run_subprocess(['touch'] + cfiles + hfiles + ofiles)
|
now = datetime.datetime.now()
|
||||||
helpers.run_subprocess(['touch', libfile])
|
ago15 = now - datetime.timedelta(seconds=15)
|
||||||
helpers.run_subprocess(['touch', '-A', '-15', '-m'] + cfiles + hfiles)
|
ago10 = now - datetime.timedelta(seconds=10)
|
||||||
helpers.run_subprocess(['touch', '-A', '-10', '-m'] + ofiles)
|
ago5 = now - datetime.timedelta(seconds=5)
|
||||||
helpers.run_subprocess(['touch', '-A', '-05', '-m', libfile])
|
formatstring = "%Y%m%d%H%M.%S"
|
||||||
|
helpers.run_subprocess(['touch', '-t', ago15.strftime(formatstring)] + cfiles + hfiles)
|
||||||
|
helpers.run_subprocess(['touch', '-t', ago10.strftime(formatstring)] + ofiles)
|
||||||
|
helpers.run_subprocess(['touch', '-t', ago5.strftime(formatstring), libfile])
|
||||||
mtime_lib_orig = os.stat(libfile).st_mtime_ns
|
mtime_lib_orig = os.stat(libfile).st_mtime_ns
|
||||||
|
|
||||||
# touch the candidate .c / .h file
|
# touch the candidate .c / .h file
|
||||||
helpers.run_subprocess(['touch', '-A', '15', '-m', file])
|
helpers.run_subprocess(['touch', '-t', now.strftime(formatstring), file])
|
||||||
|
|
||||||
# rebuild
|
# rebuild
|
||||||
helpers.run_subprocess(['make'], implementation.path())
|
helpers.run_subprocess(['make'], implementation.path())
|
||||||
|
Loading…
Reference in New Issue
Block a user