summaryrefslogtreecommitdiff
path: root/tests/test_driver.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_driver.pl')
-rw-r--r--tests/test_driver.pl18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index a7a3b9f..38ee54a 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -825,15 +825,29 @@ sub remove_directory_tree_inner
sub touch
{
- local (@filenames) = @_;
local ($file);
- foreach $file (@filenames) {
+ foreach $file (@_) {
(open(T, ">> $file") && print(T "\n") && close(T))
|| &error("Couldn't touch $file: $!\n", 1);
}
}
+# Touch with a time offset. To DTRT, call touch() then use stat() to get the
+# access/mod time for each file and apply the offset.
+
+sub utouch
+{
+ local ($off) = shift;
+ local ($file);
+
+ &touch(@_);
+
+ local (@s) = stat($_[0]);
+
+ utime($s[8]+$off, $s[9]+$off, @_);
+}
+
# open a file, write some stuff to it, and close it.
sub create_file