Path: blob/main/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh
106138 views
1usage()2{3cat <<__EOF__ >&24usage: $(basename $0)56This script regenerates the DTrace test suite makefiles. It should be run7whenever \$srcdir/cddl/contrib/opensolaris/cmd/dtrace/test/tst is modified.8__EOF__9exit 110}1112# Format a file list for use in a make(1) variable assignment: take the13# basename of each input file and append " \" to it.14fmtflist()15{16awk 'function bn(f) {17sub(".*/", "", f)18return f19}20{print " ", bn($1), " \\"}'21}2223genmakefile()24{25local class=$126local group=$22728local tdir=${CONTRIB_TESTDIR}/${class}/${group}29local tfiles=$(find $tdir -type f -a \30\( -name \*.d -o -name \*.ksh -o -name \*.out \) | sort | fmtflist)31local tcfiles=$(find $tdir -type f -a -name \*.c | sort | fmtflist)32local texes=$(find $tdir -type f -a -name \*.exe | sort | fmtflist)3334# One-off variable definitions.35local special36case "$group" in37proc)38special="39LIBADD.tst.sigwait.exe+= rt40"41;;42raise)43special="44TEST_METADATA.t_dtrace_contrib+= required_memory=\"4g\"45"46;;47safety)48special="49TEST_METADATA.t_dtrace_contrib+= required_memory=\"4g\"50"51;;52uctf)53special="54WITH_CTF=YES55"56;;57esac5859local makefile=$(mktemp)60cat <<__EOF__ > $makefile61#62# This Makefile was generated by \$srcdir${ORIGINDIR#${TOPDIR}}/genmakefiles.sh.63#6465PACKAGE= tests6667\${PACKAGE}FILES= \\68$tfiles6970TESTEXES= \\71$texes7273CFILES= \\74$tcfiles7576$special77.include "../../dtrace.test.mk"78__EOF__7980mv -f $makefile ${ORIGINDIR}/../${class}/${group}/Makefile81}8283set -e8485if [ $# -ne 0 ]; then86usage87fi8889export LC_ALL=C9091readonly ORIGINDIR=$(realpath $(dirname $0))92readonly TOPDIR=$(realpath ${ORIGINDIR}/../../../../..)93readonly CONTRIB_TESTDIR=${TOPDIR}/cddl/contrib/opensolaris/cmd/dtrace/test/tst9495for class in common i386 amd64; do96for group in $(find ${CONTRIB_TESTDIR}/$class -mindepth 1 -maxdepth 1 -type d); do97genmakefile $class $(basename $group)98done99done100101102