]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/pjdfstest/tests/utimensat/05.t
Upgrade our copies of clang, llvm, lldb and compiler-rt to r312293 from
[FreeBSD/FreeBSD.git] / contrib / pjdfstest / tests / utimensat / 05.t
1 #! /bin/sh
2 # vim: filetype=sh noexpandtab ts=8 sw=8
3 # $FreeBSD$
4
5 desc="utimensat can follow symlinks"
6
7 dir=`dirname $0`
8 . ${dir}/../misc.sh
9
10 require "utimensat"
11
12 echo "1..16"
13
14 n0=`namegen`
15 n1=`namegen`
16 n2=`namegen`
17 DATE1=1900000000 #Sun Mar 17 11:46:40 MDT 2030
18 DATE2=1950000000 #Fri Oct 17 04:40:00 MDT 2031
19 DATE3=1960000000 #Mon Feb  9 21:26:40 MST 2032
20 DATE4=1970000000 #Fri Jun  4 16:13:20 MDT 2032
21 DATE5=1980000000 #Tue Sep 28 10:00:00 MDT 2032
22 DATE6=1990000000 #Sat Jan 22 02:46:40 MST 2033
23
24 expect 0 mkdir ${n1} 0755
25 cdir=`pwd`
26 cd ${n1}
27
28
29 create_file regular ${n0}
30 ln -s ${n0} ${n2}
31 expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0
32
33 expect 0 open . O_RDONLY : utimensat 0 ${n2} $DATE3 0 $DATE4 0 AT_SYMLINK_NOFOLLOW
34 expect $DATE1 lstat ${n0} atime
35 expect $DATE2 lstat ${n0} mtime
36 expect $DATE3 lstat ${n2} atime
37 expect $DATE4 lstat ${n2} mtime
38
39 expect 0 open . O_RDONLY : utimensat 0 ${n2} $DATE5 0 $DATE6 0 0
40 expect $DATE5 lstat ${n0} atime
41 expect $DATE6 lstat ${n0} mtime
42 # If atime is disabled on the current mount, then ${n2}'s atime should still be
43 # $DATE3.  However, if atime is enabled, then ${n2}'s atime will be the current
44 # system time.  For this test, it's sufficient to simply check that it didn't
45 # get set to DATE5
46 test_check "$DATE5" -ne `"$fstest" lstat ${n2} atime`
47 expect $DATE4 lstat ${n2} mtime
48
49 expect 0 unlink ${n0}
50 expect 0 unlink ${n2}
51
52 cd ${cdir}
53 expect 0 rmdir ${n1}