Mercurial > gnulib
annotate tests/test-utimens.h @ 40186:8964917f9574
autoupdate
author | Karl Berry <karl@freefriends.org> |
---|---|
date | Mon, 18 Feb 2019 08:02:49 -0800 |
parents | b06060465f09 |
children |
rev | line source |
---|---|
12156 | 1 /* Test of file timestamp modification functions. |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
39833
diff
changeset
|
2 Copyright (C) 2009-2019 Free Software Foundation, Inc. |
12156 | 3 |
4 This program is free software: you can redistribute it and/or modify | |
5 it under the terms of the GNU General Public License as published by | |
12520
e84eea643139
tests: fix license on several tests
Eric Blake <ebb9@byu.net>
parents:
12495
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
12156 | 7 (at your option) any later version. |
8 | |
9 This program is distributed in the hope that it will be useful, | |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 GNU General Public License for more details. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
19190 | 15 along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
12156 | 16 |
12171
47c9f1788846
test-stat-time, test-utimens: improve portability
Eric Blake <ebb9@byu.net>
parents:
12165
diff
changeset
|
17 #include "test-utimens-common.h" |
12156 | 18 |
12171
47c9f1788846
test-stat-time, test-utimens: improve portability
Eric Blake <ebb9@byu.net>
parents:
12165
diff
changeset
|
19 /* This file is designed to test both utimens(a,b) and |
47c9f1788846
test-stat-time, test-utimens: improve portability
Eric Blake <ebb9@byu.net>
parents:
12165
diff
changeset
|
20 utimensat(AT_FDCWD,a,b,0). FUNC is the function to test. Assumes |
12173
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
21 that BASE and ASSERT are already defined. If PRINT, warn before |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
22 skipping tests with status 77. */ |
12156 | 23 static int |
12173
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
24 test_utimens (int (*func) (char const *, struct timespec const *), bool print) |
12156 | 25 { |
26 struct stat st1; | |
27 struct stat st2; | |
28 | |
29 ASSERT (close (creat (BASE "file", 0600)) == 0); | |
39833
4c9d0c898076
timespec: fix resolution confusion
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
30 /* If utimens truncates to worse resolution than the file system |
12165
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
31 supports, then time can appear to go backwards between now and a |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
32 follow-up utimens with UTIME_NOW or a NULL timespec. Use |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
33 UTIMECMP_TRUNCATE_SOURCE to compensate, with st1 as the |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
34 source. */ |
12156 | 35 ASSERT (stat (BASE "file", &st1) == 0); |
12171
47c9f1788846
test-stat-time, test-utimens: improve portability
Eric Blake <ebb9@byu.net>
parents:
12165
diff
changeset
|
36 nap (); |
12165
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
37 ASSERT (func (BASE "file", NULL) == 0); |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
38 ASSERT (stat (BASE "file", &st2) == 0); |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
39 ASSERT (0 <= utimecmp (BASE "file", &st2, &st1, UTIMECMP_TRUNCATE_SOURCE)); |
12466
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
40 if (check_ctime) |
16092
936e267d6906
tests: factor out st_ctime-comparison code (a dozen uses)
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
41 ASSERT (ctime_compare (&st1, &st2) < 0); |
12165
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
42 { |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
43 /* On some NFS systems, the 'now' timestamp of creat or a NULL |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
44 timespec is determined by the server, but the 'now' timestamp |
12171
47c9f1788846
test-stat-time, test-utimens: improve portability
Eric Blake <ebb9@byu.net>
parents:
12165
diff
changeset
|
45 determined by gettime() (as is done when using UTIME_NOW) is |
12165
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
46 determined by the client; since the two machines are not |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
47 necessarily on the same clock, this is another case where time |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
48 can appear to go backwards. The rest of this test cares about |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
49 client time, so manually use gettime() to set both times. */ |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
50 struct timespec ts[2]; |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
51 gettime (&ts[0]); |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
52 ts[1] = ts[0]; |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
53 ASSERT (func (BASE "file", ts) == 0); |
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
54 ASSERT (stat (BASE "file", &st1) == 0); |
12171
47c9f1788846
test-stat-time, test-utimens: improve portability
Eric Blake <ebb9@byu.net>
parents:
12165
diff
changeset
|
55 nap (); |
12165
c5a8a8e67e6f
utimens-tests: port to NFS file systems
Eric Blake <ebb9@byu.net>
parents:
12156
diff
changeset
|
56 } |
12156 | 57 |
58 /* Invalid arguments. */ | |
59 errno = 0; | |
60 ASSERT (func ("no_such", NULL) == -1); | |
61 ASSERT (errno == ENOENT); | |
62 errno = 0; | |
12194
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
63 ASSERT (func ("no_such/", NULL) == -1); |
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
64 ASSERT (errno == ENOENT || errno == ENOTDIR); |
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
65 errno = 0; |
12156 | 66 ASSERT (func ("", NULL) == -1); |
67 ASSERT (errno == ENOENT); | |
68 { | |
19059
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
69 struct timespec ts[2]; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
70 ts[0].tv_sec = Y2K; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
71 ts[0].tv_nsec = UTIME_BOGUS_POS; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
72 ts[1].tv_sec = Y2K; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
73 ts[1].tv_nsec = 0; |
12156 | 74 errno = 0; |
75 ASSERT (func (BASE "file", ts) == -1); | |
76 ASSERT (errno == EINVAL); | |
77 } | |
78 { | |
19059
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
79 struct timespec ts[2]; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
80 ts[0].tv_sec = Y2K; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
81 ts[0].tv_nsec = 0; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
82 ts[1].tv_sec = Y2K; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
83 ts[1].tv_nsec = UTIME_BOGUS_NEG; |
12156 | 84 errno = 0; |
85 ASSERT (func (BASE "file", ts) == -1); | |
86 ASSERT (errno == EINVAL); | |
87 } | |
12194
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
88 { |
19059
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
89 struct timespec ts[2]; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
90 ts[0].tv_sec = Y2K; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
91 ts[0].tv_nsec = 0; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
92 ts[1] = ts[0]; |
12194
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
93 errno = 0; |
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
94 ASSERT (func (BASE "file/", ts) == -1); |
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
95 ASSERT (errno == ENOTDIR || errno == EINVAL); |
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
96 } |
12156 | 97 ASSERT (stat (BASE "file", &st2) == 0); |
98 ASSERT (st1.st_atime == st2.st_atime); | |
99 ASSERT (get_stat_atime_ns (&st1) == get_stat_atime_ns (&st2)); | |
100 ASSERT (utimecmp (BASE "file", &st1, &st2, 0) == 0); | |
101 | |
102 /* Set both times. */ | |
103 { | |
19059
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
104 struct timespec ts[2]; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
105 ts[0].tv_sec = Y2K; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
106 ts[0].tv_nsec = BILLION / 2 - 1; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
107 ts[1].tv_sec = Y2K; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
108 ts[1].tv_nsec = BILLION - 1; |
12156 | 109 ASSERT (func (BASE "file", ts) == 0); |
110 ASSERT (stat (BASE "file", &st2) == 0); | |
111 ASSERT (st2.st_atime == Y2K); | |
112 ASSERT (0 <= get_stat_atime_ns (&st2)); | |
113 ASSERT (get_stat_atime_ns (&st2) < BILLION / 2); | |
114 ASSERT (st2.st_mtime == Y2K); | |
115 ASSERT (0 <= get_stat_mtime_ns (&st2)); | |
116 ASSERT (get_stat_mtime_ns (&st2) < BILLION); | |
12466
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
117 if (check_ctime) |
16092
936e267d6906
tests: factor out st_ctime-comparison code (a dozen uses)
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
118 ASSERT (ctime_compare (&st1, &st2) < 0); |
12156 | 119 } |
120 | |
121 /* Play with UTIME_OMIT, UTIME_NOW. */ | |
122 { | |
12466
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
123 struct stat st3; |
19059
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
124 struct timespec ts[2]; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
125 ts[0].tv_sec = BILLION; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
126 ts[0].tv_nsec = UTIME_OMIT; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
127 ts[1].tv_sec = 0; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
128 ts[1].tv_nsec = UTIME_NOW; |
12466
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
129 nap (); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
130 ASSERT (func (BASE "file", ts) == 0); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
131 ASSERT (stat (BASE "file", &st3) == 0); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
132 ASSERT (st3.st_atime == Y2K); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
133 ASSERT (0 <= get_stat_atime_ns (&st3)); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
134 ASSERT (get_stat_atime_ns (&st3) < BILLION / 2); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
135 /* See comment above about this utimecmp call. */ |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
136 ASSERT (0 <= utimecmp (BASE "file", &st3, &st1, UTIMECMP_TRUNCATE_SOURCE)); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
137 if (check_ctime) |
16092
936e267d6906
tests: factor out st_ctime-comparison code (a dozen uses)
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
138 ASSERT (ctime_compare (&st2, &st3) < 0); |
12466
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
139 nap (); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
140 ts[0].tv_nsec = 0; |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
141 ts[1].tv_nsec = UTIME_OMIT; |
12156 | 142 ASSERT (func (BASE "file", ts) == 0); |
143 ASSERT (stat (BASE "file", &st2) == 0); | |
12466
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
144 ASSERT (st2.st_atime == BILLION); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
145 ASSERT (get_stat_atime_ns (&st2) == 0); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
146 ASSERT (st3.st_mtime == st2.st_mtime); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
147 ASSERT (get_stat_mtime_ns (&st3) == get_stat_mtime_ns (&st2)); |
e31a9e90d604
utimens: check for ctime update
Eric Blake <ebb9@byu.net>
parents:
12194
diff
changeset
|
148 if (check_ctime) |
16092
936e267d6906
tests: factor out st_ctime-comparison code (a dozen uses)
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
149 ASSERT (ctime_compare (&st3, &st2) < 0); |
12156 | 150 } |
151 | |
12173
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
152 /* Make sure this dereferences symlinks. */ |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
153 if (symlink (BASE "file", BASE "link")) |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
154 { |
12495 | 155 ASSERT (unlink (BASE "file") == 0); |
12173
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
156 if (print) |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
157 fputs ("skipping test: symlinks not supported on this file system\n", |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
158 stderr); |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
159 return 77; |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
160 } |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
161 ASSERT (lstat (BASE "link", &st1) == 0); |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
162 ASSERT (st1.st_mtime != Y2K); |
12194
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
163 errno = 0; |
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
164 ASSERT (func (BASE "link/", NULL) == -1); |
16c7c4fa9754
utimensat: work around Solaris 9 bug
Eric Blake <ebb9@byu.net>
parents:
12173
diff
changeset
|
165 ASSERT (errno == ENOTDIR); |
12173
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
166 { |
19059
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
167 struct timespec ts[2]; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
168 ts[0].tv_sec = Y2K; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
169 ts[0].tv_nsec = 0; |
8e51de943f6b
futimens: don’t assume struct timespec layout
Paul Eggert <eggert@cs.ucla.edu>
parents:
18626
diff
changeset
|
170 ts[1] = ts[0]; |
12173
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
171 ASSERT (func (BASE "link", ts) == 0); |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
172 ASSERT (lstat (BASE "link", &st2) == 0); |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
173 /* Can't compare atimes, since lstat() changes symlink atime on cygwin. */ |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
174 ASSERT (st1.st_mtime == st2.st_mtime); |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
175 ASSERT (stat (BASE "link", &st2) == 0); |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
176 ASSERT (st2.st_mtime == Y2K); |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
177 ASSERT (get_stat_mtime_ns (&st2) == 0); |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
178 } |
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
179 |
12156 | 180 /* Cleanup. */ |
12173
efdb2ab5743f
utimens: let lutimens work on non-symlinks
Eric Blake <ebb9@byu.net>
parents:
12171
diff
changeset
|
181 ASSERT (unlink (BASE "link") == 0); |
12156 | 182 ASSERT (unlink (BASE "file") == 0); |
183 return 0; | |
184 } |