freebsd-nq/tools/regression/execve/Makefile
Will Andrews 7a37b5fc17 Add a ${CP} alias for copying files in the build.
Some users build FreeBSD as non-root in Perforce workspaces.  By default,
Perforce sets files read-only unless they're explicitly being edited.
As a result, the -f argument must be used to cp in order to override the
read-only flag when copying source files to object directories.  Bare use of
'cp' should be avoided in the future.

Update all current users of 'cp' in the src tree.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	Spectra Logic
2015-01-16 21:39:08 +00:00

71 lines
1.7 KiB
Makefile

# $FreeBSD$
PROG= doexec
MAN=
RP= ./${PROG}
TD= ${.CURDIR}/tests
TESTSCRIPTS= nonexistshell devnullscript badinterplen goodscript \
scriptarg scriptarg-nospace
CLEANFILES= goodaout truncaout sparseaout empty ${TESTSCRIPTS}
all: ${PROG} goodaout ${TESTSCRIPTS}
.for x in ${TESTSCRIPTS}
${x}: ${TD}/${x}
${CP} ${TD}/${x} .
chmod +x ${x}
.endfor
regress: test-empty test-nonexist test-nonexistshell \
test-devnullscript test-badinterplen test-goodscript \
test-scriptarg test-scriptarg-nospace test-goodaout \
test-truncaout test-sparseaout
test-empty: ${PROG}
rm -f empty
touch empty
chmod +x empty
${RP} empty | grep 'Exec format error'
test-nonexist: ${PROG}
${RP} ${TD}/nonexistent | grep 'No such file or directory'
test-nonexistshell: ${PROG} nonexistshell
${RP} nonexistshell | grep 'No such file or directory'
test-devnullscript: ${PROG} devnullscript
${RP} devnullscript | grep 'Permission denied'
test-badinterplen: ${PROG} badinterplen
${RP} badinterplen | grep 'No such file or directory'
test-goodscript: ${PROG} goodscript
${RP} goodscript | grep 'succeeded'
test-scriptarg: ${PROG} scriptarg
${RP} scriptarg 2>&1 | grep '+ echo succeeded'
test-scriptarg-nospace: ${PROG} scriptarg-nospace
${RP} scriptarg-nospace 2>&1 | grep '+ echo succeeded'
goodaout: ${TD}/goodaout.c
${CC} -static -o ${.TARGET} ${TD}/goodaout.c
test-goodaout: ${PROG} goodaout
${RP} goodaout | grep 'succeeded'
test-truncaout: ${PROG} goodaout
truncate -s 16 truncaout
chmod a+x truncaout
${RP} truncaout | grep 'Exec format error'
test-sparseaout: ${PROG}
/bin/rm -rf sparseaout
truncate -s 20480 sparseaout
chmod a+x sparseaout
${RP} sparseaout | grep 'Exec format error'
.include <bsd.prog.mk>