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