From 9bb92cfd2a88e0cb20cde348e52d8484f2918428 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Fri, 31 Mar 2023 11:21:26 +0200 Subject: [PATCH] regress: Add function to test atime with expected value in check_protect() --- regress/scripts/functions.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/regress/scripts/functions.pm b/regress/scripts/functions.pm index eddca8d23..65099b839 100644 --- a/regress/scripts/functions.pm +++ b/regress/scripts/functions.pm @@ -2597,7 +2597,20 @@ sub get_perm # Parse the output of llist volume to check the protection parameters sub check_protect { - my ($file, $name, $status, $protect, $useprotect) = @_; + my ($file, $name, $status, $protect, $useprotect, $atime) = @_; + + if ($atime) { + my @attr = stat("$tmp/$name") or die "Unable to find $tmp/$name"; + if ($attr[8] > ($attr[9] + $atime + 2) || $attr[8] < ($attr[9] + $atime - 2)) { + print "ERROR: the atime value is not correct fname=$tmp/$name atime=$attr[8] mtime=$attr[9] diff=$atime\n"; + exit 1; + } + if ($protect && ($attr[2] & 07777) != 0400) { + print "ERROR: $tmp/$name is not protected mode=", $attr[2] & 07777, "\n"; + exit 1; + } + } + open(FP, $file) or die "Unable to open $file. $!"; my $found=0; while (my $line = ) { -- 2.47.3