summaryrefslogtreecommitdiff
path: root/regress/sys/kern/realpath-unmount/Makefile
blob: 8159dc0f398aae8f3a5d9401c9ddedbc59808eae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# $OpenBSD: Makefile,v 1.3 2020/12/17 00:51:12 bluhm Exp $

# Call realpath(3) in combination with chroot(2), chdir(2).
# Use umount(8) to check that the mountpoint leaks no vnode.
# There were vnode reference counting bugs in the kernel.

PROGS=		realpath-chroot realpath-chdir
CLEANFILES=	diskimage

.PHONY: mount unconfig clean

diskimage: unconfig
	${SUDO} dd if=/dev/zero of=diskimage bs=512 count=4k
	${SUDO} vnconfig vnd0 diskimage
	${SUDO} newfs vnd0c

mount: diskimage
	${SUDO} mkdir -p /mnt/regress-realpath
	${SUDO} mount /dev/vnd0c /mnt/regress-realpath

unconfig:
	-${SUDO} umount -f /dev/vnd0c 2>/dev/null || true
	-${SUDO} rmdir /mnt/regress-realpath 2>/dev/null || true
	-${SUDO} vnconfig -u vnd0 2>/dev/null || true
	-${SUDO} rm -f stamp-setup

REGRESS_SETUP	=	${PROGS} mount
REGRESS_CLEANUP =	unconfig
REGRESS_TARGETS =

REGRESS_TARGETS +=	run-chroot
run-chroot:
	${SUDO} mkdir -p /mnt/regress-realpath
	${SUDO} ./realpath-chroot /mnt/regress-realpath /
	${SUDO} umount /mnt/regress-realpath

REGRESS_TARGETS +=	run-chroot-dir
run-chroot-dir:
	${SUDO} mkdir -p /mnt/regress-realpath/foo
	${SUDO} ./realpath-chroot /mnt/regress-realpath/foo /
	${SUDO} umount /mnt/regress-realpath

REGRESS_TARGETS +=	run-chroot-subdir
run-chroot-subdir:
	${SUDO} mkdir -p /mnt/regress-realpath/foo
	${SUDO} ./realpath-chroot /mnt/regress-realpath /foo
	${SUDO} umount /mnt/regress-realpath

REGRESS_TARGETS +=	run-chroot-dir-subdir
run-chroot-dir-subdir:
	${SUDO} mkdir -p /mnt/regress-realpath/foo/bar
	${SUDO} ./realpath-chroot /mnt/regress-realpath/foo /bar
	${SUDO} umount /mnt/regress-realpath

REGRESS_TARGETS +=	run-chdir
run-chdir:
	${SUDO} mkdir -p /mnt/regress-realpath
	${SUDO} ./realpath-chdir /mnt/regress-realpath .
	${SUDO} umount /mnt/regress-realpath

REGRESS_TARGETS +=	run-chdir-dir
run-chdir-dir:
	${SUDO} mkdir -p /mnt/regress-realpath/foo
	${SUDO} ./realpath-chdir /mnt/regress-realpath/foo .
	${SUDO} umount /mnt/regress-realpath

REGRESS_TARGETS +=	run-chdir-subdir
run-chdir-subdir:
	${SUDO} mkdir -p /mnt/regress-realpath/foo
	${SUDO} ./realpath-chdir /mnt/regress-realpath foo
	${SUDO} umount /mnt/regress-realpath

REGRESS_TARGETS +=	run-chdir-dir-subdir
run-chdir-dir-subdir:
	${SUDO} mkdir -p /mnt/regress-realpath/foo/bar
	${SUDO} ./realpath-chdir /mnt/regress-realpath/foo bar
	${SUDO} umount /mnt/regress-realpath

REGRESS_ROOT_TARGETS =	${REGRESS_TARGETS}

.include <bsd.regress.mk>