Skip to content

Commit 2d5edb3

Browse files
committed
tests/xtouch: New utility
POSIX touch(1) doesn't include the -h option, and indeed OpenBSD doesn't implement it. Making our own utility also lets us add some handy extensions like -p (create parents) and -M (set permissions).
1 parent 3139cbc commit 2d5edb3

23 files changed

Lines changed: 263 additions & 90 deletions

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,12 @@ DISTCHECK_FLAGS := -s TEST_FLAGS="--sudo --verbose=skipped"
198198
bfs: $(BIN)/bfs
199199
.PHONY: bfs
200200

201-
all: $(BIN)/bfs $(BIN)/tests/mksock $(BIN)/tests/trie $(BIN)/tests/xtimegm
201+
all: \
202+
$(BIN)/bfs \
203+
$(BIN)/tests/mksock \
204+
$(BIN)/tests/trie \
205+
$(BIN)/tests/xtimegm \
206+
$(BIN)/tests/xtouch
202207
.PHONY: all
203208

204209
$(BIN)/bfs: \
@@ -230,6 +235,7 @@ $(BIN)/bfs: \
230235
$(BIN)/tests/mksock: $(OBJ)/tests/mksock.o
231236
$(BIN)/tests/trie: $(OBJ)/src/trie.o $(OBJ)/tests/trie.o
232237
$(BIN)/tests/xtimegm: $(OBJ)/src/xtime.o $(OBJ)/tests/xtimegm.o
238+
$(BIN)/tests/xtouch: $(OBJ)/src/xtime.o $(OBJ)/tests/xtouch.o
233239

234240
$(BIN)/%:
235241
@$(MKDIR) $(@D)
@@ -257,7 +263,7 @@ $(FLAG_GOALS): $(FLAG_PREREQS)
257263
check: $(CHECKS)
258264
.PHONY: check $(CHECKS)
259265

260-
$(STRATEGY_CHECKS): check-%: $(BIN)/bfs $(BIN)/tests/mksock
266+
$(STRATEGY_CHECKS): check-%: $(BIN)/bfs $(BIN)/tests/mksock $(BIN)/tests/xtouch
261267
./tests/tests.sh --bfs="$(BIN)/bfs -S $*" $(TEST_FLAGS)
262268

263269
check-trie check-xtimegm: check-%: $(BIN)/tests/%

tests/bfs/L_capable.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ clean_scratch
55

66
skip_unless invoke_bfs scratch -quit -capable
77

8-
$TOUCH scratch/{normal,capable}
8+
"$XTOUCH" scratch/{normal,capable}
99
sudo setcap all+ep scratch/capable
1010
ln -s capable scratch/link
1111

tests/bfs/capable.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ clean_scratch
55

66
skip_unless invoke_bfs scratch -quit -capable
77

8-
$TOUCH scratch/{normal,capable}
8+
"$XTOUCH" scratch/{normal,capable}
99
sudo setcap all+ep scratch/capable
1010
ln -s capable scratch/link
1111

tests/bfs/color_ls.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
clean_scratch
2-
touchp scratch/foo/bar/baz
2+
"$XTOUCH" -p scratch/foo/bar/baz
33
ln -s foo/bar/baz scratch/link
44
ln -s foo/bar/nowhere scratch/broken
55
ln -s foo/bar/nowhere/nothing scratch/nested

tests/bsd/L_acl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ clean_scratch
22

33
skip_unless invoke_bfs scratch -quit -acl
44

5-
$TOUCH scratch/{normal,acl}
5+
"$XTOUCH" scratch/{normal,acl}
66
skip_unless set_acl scratch/acl
77
ln -s acl scratch/link
88

tests/bsd/acl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ clean_scratch
22

33
skip_unless invoke_bfs scratch -quit -acl
44

5-
$TOUCH scratch/{normal,acl}
5+
"$XTOUCH" scratch/{normal,acl}
66
skip_unless set_acl scratch/acl
77
ln -s acl scratch/link
88

tests/bsd/flags.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ skip_unless invoke_bfs scratch -quit -flags offline
22

33
clean_scratch
44

5-
$TOUCH scratch/{foo,bar}
5+
"$XTOUCH" scratch/{foo,bar}
66
skip_unless chflags offline scratch/bar
77

88
bfs_diff scratch -flags -offline,nohidden

tests/bsd/rm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
clean_scratch
2-
touchp scratch/foo/bar/baz
2+
"$XTOUCH" -p scratch/foo/bar/baz
33

44
(cd scratch && invoke_bfs . -rm)
55

tests/common/L_mount.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ clean_scratch
55
mkdir scratch/{foo,mnt}
66
sudo mount -t tmpfs tmpfs scratch/mnt
77
ln -s ../mnt scratch/foo/bar
8-
$TOUCH scratch/mnt/baz
8+
"$XTOUCH" scratch/mnt/baz
99
ln -s ../mnt/baz scratch/foo/qux
1010

1111
bfs_diff -L scratch -mount

tests/common/delete.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
clean_scratch
2-
touchp scratch/foo/bar/baz
2+
"$XTOUCH" -p scratch/foo/bar/baz
33

44
# Don't try to delete '.'
55
(cd scratch && invoke_bfs . -delete)

0 commit comments

Comments
 (0)