xref: /freebsd/contrib/pjdfstest/tests/utimensat/08.t (revision 531c2d7af3cd2e64eec94aa1b19c4b2f16fce515)
1*3416500aSEnji Cooper#! /bin/sh
2*3416500aSEnji Cooper# vim: filetype=sh noexpandtab ts=8 sw=8
3*3416500aSEnji Cooper# $FreeBSD$
4*3416500aSEnji Cooper
5*3416500aSEnji Cooperdesc="utimensat can set timestamps with subsecond precision"
6*3416500aSEnji Cooper
7*3416500aSEnji Cooperdir=`dirname $0`
8*3416500aSEnji Cooper. ${dir}/../misc.sh
9*3416500aSEnji Cooper
10*3416500aSEnji Cooperrequire "utimensat"
11*3416500aSEnji Cooper
12*3416500aSEnji Cooperecho "1..9"
13*3416500aSEnji Cooper
14*3416500aSEnji Coopern0=`namegen`
15*3416500aSEnji Coopern1=`namegen`
16*3416500aSEnji Cooper# Different file systems have different timestamp resolutions.  Check that they
17*3416500aSEnji Cooper# can do 0.1 second, but don't bother checking the finest resolution.
18*3416500aSEnji CooperDATE1=100000000 #Sat Mar  3 02:46:40 MST 1973
19*3416500aSEnji CooperDATE1_NS=100000000
20*3416500aSEnji CooperDATE2=200000000 #Mon May  3 13:33:20 MDT 1976
21*3416500aSEnji CooperDATE2_NS=200000000
22*3416500aSEnji Cooper
23*3416500aSEnji Cooperexpect 0 mkdir ${n1} 0755
24*3416500aSEnji Coopercdir=`pwd`
25*3416500aSEnji Coopercd ${n1}
26*3416500aSEnji Cooper
27*3416500aSEnji Coopercreate_file regular ${n0} 0644
28*3416500aSEnji Cooperexpect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 $DATE1_NS $DATE2 $DATE2_NS 0
29*3416500aSEnji Cooperexpect $DATE1_NS lstat ${n0} atime_ns
30*3416500aSEnji Cooperexpect $DATE2_NS lstat ${n0} mtime_ns
31*3416500aSEnji Cooperif supported "stat_st_birthtime"; then
32*3416500aSEnji Cooper	expect $DATE2_NS lstat ${n0} birthtime_ns
33*3416500aSEnji Cooperelse
34*3416500aSEnji Cooper	test_check true
35*3416500aSEnji Cooperfi
36*3416500aSEnji Cooper
37*3416500aSEnji Cooperexpect 0 unlink ${n0}
38*3416500aSEnji Cooper
39*3416500aSEnji Coopercd ${cdir}
40*3416500aSEnji Cooperexpect 0 rmdir ${n1}
41