xref: /freebsd/contrib/pjdfstest/tests/utimensat/00.t (revision f7c32ed617858bcd22f8d1b03199099d50125721)
1#! /bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD$
4
5desc="utimensat changes timestamps on any type of file"
6
7dir=`dirname $0`
8. ${dir}/../misc.sh
9
10require "utimensat"
11
12echo "1..32"
13
14n0=`namegen`
15n1=`namegen`
16
17expect 0 mkdir ${n1} 0755
18cdir=`pwd`
19cd ${n1}
20
21DATE1=1900000000 #Sun Mar 17 11:46:40 MDT 2030
22DATE2=1950000000 #Fri Oct 17 04:40:00 MDT 2031
23for type in regular dir fifo block char socket; do
24	create_file ${type} ${n0}
25	expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0
26	expect $DATE1 lstat ${n0} atime
27	expect $DATE2 lstat ${n0} mtime
28	if [ "${type}" = "dir" ]; then
29		expect 0 rmdir ${n0}
30	else
31		expect 0 unlink ${n0}
32	fi
33done
34
35cd ${cdir}
36expect 0 rmdir ${n1}
37