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