1605b213eSEnji Cooper.PATH: ${.CURDIR} 2605b213eSEnji Cooper 343faedc1SGlen BarberPACKAGE= tests 443faedc1SGlen Barber 5301441dcSEnji Cooper_REBASE_SCRIPT= mkimg_test 6301441dcSEnji CooperATF_TESTS_SH= ${_REBASE_SCRIPT} 7cd0b4a3cSMarcel Moolenaar 8370d612fSMarcel MoolenaarSOURCES!= cd ${.CURDIR}; echo *.hex 9370d612fSMarcel Moolenaar${PACKAGE}FILES+= ${SOURCES:S,.hex,,g} 10cd0b4a3cSMarcel Moolenaar 11605b213eSEnji Cooper.for f in ${${PACKAGE}FILES} 12370d612fSMarcel Moolenaar$f: $f.hex 13370d612fSMarcel Moolenaar sed -e '/^#.*/D' < ${.ALLSRC} > ${.TARGET} 14605b213eSEnji Cooper.endfor 15cd0b4a3cSMarcel Moolenaar 16*3ac62888SAlex Richardson# Note: Pre-generating this test file saves a lot of time when building on 17*3ac62888SAlex Richardson# emulated platforms such as QEMU. It can take about 2-5 seconds to generate 18*3ac62888SAlex Richardson# the test file using jot (depending on the emulated architecture) and this 19*3ac62888SAlex Richardson# is done for each of the 168 test configurations. 20*3ac62888SAlex Richardson# The effect is even more pronounced on CHERI-RISCV QEMU (emulating CHERI inside 21*3ac62888SAlex Richardson# QEMU adds additional run-time overhead): Running the apm_1x1_512_raw without 22*3ac62888SAlex Richardson# the pre-generated file takes about 108 seconds of which 102 seconds (over 95%) 23*3ac62888SAlex Richardson# were spent running jot -b. It's even worse on CHERI-MIPS QEMU: 187 seconds 24*3ac62888SAlex Richardson# for jot -b P 2097152 > /dev/null. By using a pre-generated 4MB file, the 25*3ac62888SAlex Richardson# slowest test variant (vtoc8_63x255_4096_vhdx) now only takes 29 seconds (of 26*3ac62888SAlex Richardson# which 26s are spent in hexdump -C) instead of previously 2min30s. 27*3ac62888SAlex Richardson${PACKAGE}FILES+= partition_data_4M.bin 28*3ac62888SAlex Richardsonpartition_data_4M.bin: Makefile 29*3ac62888SAlex Richardson jot -b P 2097152 > ${.TARGET} || rm -f ${.TARGET} 30*3ac62888SAlex Richardson 31430f7286SEnji CooperCLEANFILES+= ${${PACKAGE}FILES}} 32d60351dfSMarcel Moolenaar 33*3ac62888SAlex Richardsonrebase: partition_data_4M.bin ${_REBASE_SCRIPT} .PHONY 34*3ac62888SAlex Richardson cd ${.CURDIR}; PATH=${.OBJDIR}/..:$${PATH}:/usr/bin:/bin \ 35*3ac62888SAlex Richardson /usr/libexec/atf-sh ${.OBJDIR}/${_REBASE_SCRIPT} -s ${.OBJDIR} rebase 36cd0b4a3cSMarcel Moolenaar 37cd0b4a3cSMarcel Moolenaar.include <bsd.test.mk> 38