diff options
author | Julio Merino <jmmv@FreeBSD.org> | 2013-11-25 13:30:06 +0000 |
---|---|---|
committer | Julio Merino <jmmv@FreeBSD.org> | 2013-11-25 13:30:06 +0000 |
commit | 9e684a3a797341edca72fa72cd91577f17212195 (patch) | |
tree | 6f36c4d6ef4dd80ede8b68a822da002d7e38d645 | |
parent | f67f6c4e3ba36b58b1173ca24dd5a37405a1de1e (diff) | |
download | src-9e684a3a797341edca72fa72cd91577f17212195.tar.gz src-9e684a3a797341edca72fa72cd91577f17212195.zip |
Generate plain sh test programs from a source file.
Instead of assuming that plain sh test programs exist in the source
tree in their final form and are marked as executable, generate them
from a list of sources.
By default, just assume that the source file for a program P is P.sh
but allow the caller to customize the inputs. Similarly, also allow
the caller to apply sed(1) replacements on the output. These will
both be useful in hooking existing test code from tools/regression/
into the test suite.
Approved by: rpaulo (mentor)
Notes
Notes:
svn path=/head/; revision=258552
-rw-r--r--[-rwxr-xr-x] | share/examples/tests/tests/plain/cp_test.sh (renamed from share/examples/tests/tests/plain/cp_test) | 0 | ||||
-rw-r--r-- | share/mk/plain.test.mk | 10 |
2 files changed, 10 insertions, 0 deletions
diff --git a/share/examples/tests/tests/plain/cp_test b/share/examples/tests/tests/plain/cp_test.sh index ea6470518cda..ea6470518cda 100755..100644 --- a/share/examples/tests/tests/plain/cp_test +++ b/share/examples/tests/tests/plain/cp_test.sh diff --git a/share/mk/plain.test.mk b/share/mk/plain.test.mk index b41c5856c614..2e2752db7fa3 100644 --- a/share/mk/plain.test.mk +++ b/share/mk/plain.test.mk @@ -46,6 +46,16 @@ _TESTS+= ${PLAIN_TESTS_SH} .for _T in ${PLAIN_TESTS_SH} SCRIPTSDIR_${_T}= ${TESTSDIR} TEST_INTERFACE.${_T}= plain +CLEANFILES+= ${_T} ${_T}.tmp +# TODO(jmmv): It seems to me that this SED and SRC functionality should +# exist in bsd.prog.mk along the support for SCRIPTS. Move it there if +# this proves to be useful within the tests. +PLAIN_TESTS_SH_SED_${_T}?= # empty +PLAIN_TESTS_SH_SRC_${_T}?= ${_T}.sh +${_T}: ${PLAIN_TESTS_SH_SRC_${_T}} + cat ${.ALLSRC} | sed ${PLAIN_TESTS_SH_SED_${_T}} >${.TARGET}.tmp + chmod +x ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} .endfor .endif |