Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh
106138 views
1
2
usage()
3
{
4
cat <<__EOF__ >&2
5
usage: $(basename $0)
6
7
This script regenerates the DTrace test suite makefiles. It should be run
8
whenever \$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.
15
fmtflist()
16
{
17
awk 'function bn(f) {
18
sub(".*/", "", f)
19
return f
20
}
21
{print " ", bn($1), " \\"}'
22
}
23
24
genmakefile()
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="
40
LIBADD.tst.sigwait.exe+= rt
41
"
42
;;
43
raise)
44
special="
45
TEST_METADATA.t_dtrace_contrib+= required_memory=\"4g\"
46
"
47
;;
48
safety)
49
special="
50
TEST_METADATA.t_dtrace_contrib+= required_memory=\"4g\"
51
"
52
;;
53
uctf)
54
special="
55
WITH_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
66
PACKAGE= tests
67
68
\${PACKAGE}FILES= \\
69
$tfiles
70
71
TESTEXES= \\
72
$texes
73
74
CFILES= \\
75
$tcfiles
76
77
$special
78
.include "../../dtrace.test.mk"
79
__EOF__
80
81
mv -f $makefile ${ORIGINDIR}/../${class}/${group}/Makefile
82
}
83
84
set -e
85
86
if [ $# -ne 0 ]; then
87
usage
88
fi
89
90
export LC_ALL=C
91
92
readonly ORIGINDIR=$(realpath $(dirname $0))
93
readonly TOPDIR=$(realpath ${ORIGINDIR}/../../../../..)
94
readonly CONTRIB_TESTDIR=${TOPDIR}/cddl/contrib/opensolaris/cmd/dtrace/test/tst
95
96
for 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
100
done
101
102