From 5a2ffd3fbe6e6e60d68c2632567e53cf821f770b Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Mon, 3 Jul 2017 08:46:38 +0100 Subject: [PATCH] Generate files with certain timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Vagrantfile | 27 +++++++++++++++++++++++++++ xtests/run.sh | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 96a6b7d..32e8c61 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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 diff --git a/xtests/run.sh b/xtests/run.sh index 2d6c7e0..7e99a22 100755 --- a/xtests/run.sh +++ b/xtests/run.sh @@ -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 -- GitLab