xref: /freebsd/contrib/pjdfstest/tests/utimensat/04.t (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1#! /bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD$
4
5desc="utimensat can set mtime < atime or vice versa"
6
7dir=`dirname $0`
8. ${dir}/../misc.sh
9
10require "utimensat"
11
12echo "1..10"
13
14n0=`namegen`
15n1=`namegen`
16DATE1=100000000 #Sat Mar  3 02:46:40 MST 1973
17DATE2=200000000 #Mon May  3 13:33:20 MDT 1976
18
19expect 0 mkdir ${n1} 0755
20cdir=`pwd`
21cd ${n1}
22
23
24create_file regular ${n0}
25expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0
26expect $DATE1 lstat ${n0} atime
27expect $DATE2 lstat ${n0} mtime
28
29expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE2 0 $DATE1 0 0
30expect $DATE2 lstat ${n0} atime
31expect $DATE1 lstat ${n0} mtime
32
33expect 0 unlink ${n0}
34
35cd ${cdir}
36expect 0 rmdir ${n1}
37