Generate files with certain timestamps

This is going to be used to test time formatting.

Casualty here is that the “have you not ran the provisioning script in a year?” checker complained about there being files more than a year old, so that now has to ignore the times directory.
This commit is contained in:
Benjamin Sago 2017-07-03 08:46:38 +01:00
parent 652e27e6dd
commit 5a2ffd3fbe
2 changed files with 29 additions and 1 deletions

27
Vagrantfile vendored
View File

@ -295,6 +295,33 @@ Vagrant.configure(2) do |config|
EOF
old = '200303030000.00'
med = '200606152314.29'
new = '200907221038.53'
# Awkward date and time testcases.
config.vm.provision :shell, privileged: false, inline: <<-EOF
set -xe
mkdir "#{test_dir}/dates"
# there's no way to touch the created date of a file...
# so we have to do this the old-fashioned way!
# (and make sure these don't actually get listed)
touch -t #{old} "#{test_dir}/dates/peach"; sleep 1
touch -t #{med} "#{test_dir}/dates/plum"; sleep 1
touch -t #{new} "#{test_dir}/dates/pear"
# modified dates
touch -t #{old} -m "#{test_dir}/dates/pear"
touch -t #{med} -m "#{test_dir}/dates/peach"
touch -t #{new} -m "#{test_dir}/dates/plum"
# accessed dates
touch -t #{old} -a "#{test_dir}/dates/plum"
touch -t #{med} -a "#{test_dir}/dates/pear"
touch -t #{new} -a "#{test_dir}/dates/peach"
EOF
# Awkward extended attribute testcases.
config.vm.provision :shell, privileged: false, inline: <<-EOF

View File

@ -18,7 +18,8 @@ results="/vagrant/xtests"
# Check that no files were created more than a year ago.
# Files not from the current year use a different date format, meaning
# that tests will fail until the VM gets re-provisioned.
sudo find $testcases -mtime +365 -printf "File %p has not been modified since %TY! Consider re-provisioning; tests will probably fail.\n"
# (Ignore the folder that deliberately has dates in the past)
sudo find $testcases -mtime +365 -not -path "*/dates/*" -printf "File %p has not been modified since %TY! Consider re-provisioning; tests will probably fail.\n"
# Long view tests