summaryrefslogtreecommitdiff
path: root/regress/sys/fileops/Makefile.inc
blob: d6d2c05781ea7cfc660ebfd8b9593ef36632bbf5 (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
# $OpenBSD: Makefile.inc,v 1.3 2017/08/15 17:16:39 sf Exp $

PERL_REQUIRE != perl -e 'eval { require File::Slurp } or print $$@'

TESTS1=		create read mmap
TESTS2=		many_files_root many_files_subdir file_write
TESTS= ${TESTS1} ${TESTS2}

FILEOPS_MNT=	/mnt/regress-fileops
FILEOPS_PROG=	${.OBJDIR}/../fileops
CLEANFILES=	diskimage stamp-*

.poison !defined (MOUNT)
.poison !defined (NEWFS)

.PHONY: disk mount unconfig clean

disk: unconfig
	dd if=/dev/urandom of=diskimage bs=1M count=64
	vnconfig vnd0 diskimage
	${NEWFS} /dev/rvnd0c

mount: disk
	mkdir -p ${FILEOPS_MNT}
	${MOUNT} /dev/vnd0c ${FILEOPS_MNT}

unconfig:
	-umount -f /dev/vnd0c 2>/dev/null || true
	-rmdir ${FILEOPS_MNT} 2>/dev/null || true
	-vnconfig -u vnd0 2>/dev/null || true
	-rm -f stamp-setup diskimage

stamp-setup:
	@echo '\n======== $@ ========'
	${.MAKE} -C ${.CURDIR} mount
	date >$@

${.OBJDIR}/../fileops:
	${.MAKE} -C ${.CURDIR}/.. fileops

.for t in ${TESTS1}
REGRESS_TARGETS+=	run-regress-${t}
run-regress-${t}: stamp-setup ${.OBJDIR}/../fileops
	@echo '\n======== $@ ========'
	cd ${FILEOPS_MNT} && \
	    ${FILEOPS_PROG} ${t} ${FILEOPS_MNT}/file
.endfor

.for t in ${TESTS2}
REGRESS_TARGETS+=	run-regress-${t}
.if ! empty(PERL_REQUIRE)
run-regress-${t}:
	@echo "${PERL_REQUIRE}"
	@echo "Install the p5-File-Slurp package to run the fileops ${t} subtest"
	@echo SKIPPED
.else
run-regress-${t}: stamp-setup
	@echo '\n======== $@ ========'
	perl ${.CURDIR}/../fileops2.pl ${t} ${FILEOPS_MNT}
.endif
.endfor

REGRESS_TARGETS+=	run-regress-cleanup
run-regress-cleanup:
	@echo '\n======== $@ ========'
	umount ${FILEOPS_MNT}
	${.MAKE} -C ${.CURDIR} unconfig