1 2usage() 3{ 4 cat <<__EOF__ >&2 5usage: $(basename $0) 6 7This script regenerates the DTrace test suite makefiles. It should be run 8whenever \$srcdir/cddl/contrib/opensolaris/cmd/dtrace/test/tst is modified. 9__EOF__ 10 exit 1 11} 12 13# Format a file list for use in a make(1) variable assignment: take the 14# basename of each input file and append " \" to it. 15fmtflist() 16{ 17 awk 'function bn(f) { 18 sub(".*/", "", f) 19 return f 20 } 21 {print " ", bn($1), " \\"}' 22} 23 24genmakefile() 25{ 26 local class=$1 27 local group=$2 28 29 local tdir=${CONTRIB_TESTDIR}/${class}/${group} 30 local tfiles=$(find $tdir -type f -a \ 31 \( -name \*.d -o -name \*.ksh -o -name \*.out \) | sort | fmtflist) 32 local tcfiles=$(find $tdir -type f -a -name \*.c | sort | fmtflist) 33 local texes=$(find $tdir -type f -a -name \*.exe | sort | fmtflist) 34 35 # One-off variable definitions. 36 local special 37 case "$group" in 38 proc) 39 special=" 40LIBADD.tst.sigwait.exe+= rt 41" 42 ;; 43 raise) 44 special=" 45TEST_METADATA.t_dtrace_contrib+= required_memory=\"4g\" 46" 47 ;; 48 safety) 49 special=" 50TEST_METADATA.t_dtrace_contrib+= required_memory=\"4g\" 51" 52 ;; 53 uctf) 54 special=" 55WITH_CTF=YES 56" 57 ;; 58 esac 59 60 local makefile=$(mktemp) 61 cat <<__EOF__ > $makefile 62# 63# This Makefile was generated by \$srcdir${ORIGINDIR#${TOPDIR}}/genmakefiles.sh. 64# 65 66PACKAGE= tests 67 68\${PACKAGE}FILES= \\ 69$tfiles 70 71TESTEXES= \\ 72$texes 73 74CFILES= \\ 75$tcfiles 76 77$special 78.include "../../dtrace.test.mk" 79__EOF__ 80 81 mv -f $makefile ${ORIGINDIR}/../${class}/${group}/Makefile 82} 83 84set -e 85 86if [ $# -ne 0 ]; then 87 usage 88fi 89 90export LC_ALL=C 91 92readonly ORIGINDIR=$(realpath $(dirname $0)) 93readonly TOPDIR=$(realpath ${ORIGINDIR}/../../../../..) 94readonly CONTRIB_TESTDIR=${TOPDIR}/cddl/contrib/opensolaris/cmd/dtrace/test/tst 95 96for class in common i386 amd64; do 97 for group in $(find ${CONTRIB_TESTDIR}/$class -mindepth 1 -maxdepth 1 -type d); do 98 genmakefile $class $(basename $group) 99 done 100done 101