blob: 5d87af83aba27ca2829833918374ec64c39997ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
parse_test_deps()
{
ktest_cpus=$(nproc)
ktest_mem=""
ktest_timeout=""
ktest_kernel_append=()
ktest_images=()
ktest_scratch_devs=()
ktest_make_install=()
ktest_kernel_config_require=()
ktest_qemu_append=()
local NEXT_SCRATCH_DEV="b"
local TESTPROG=$1
local BUILD_ON_HOST=""
require-lib()
{
local req="$1"
pushd "$(dirname "$req")" > /dev/null
. $(basename "$req")
popd > /dev/null
}
require-git()
{
local req="$1"
local dir=$(basename $req)
dir=${dir%%.git}
if [[ $# -ge 2 ]]; then
dir=$2
fi
if [[ ! -d $dir ]]; then
git clone $req $dir
fi
}
do-build-deb()
{
local path=$(readlink -e "$1")
local name=$(basename $path)
get_tmpdir
make -C "$path"
cp -drl $path $ktest_tmp
pushd "$ktest_tmp/$name" > /dev/null
# make -nc actually work:
rm -f debian/*.debhelper.log
debuild --no-lintian -b -i -I -us -uc -nc
popd > /dev/null
}
# $1 is a source repository, which will be built (with make) and then turned
# into a dpkg
require-build-deb()
{
local req=$1
if ! [[ -d $req ]]; then
echo "build-deb dependency $req not found"
exit 1
fi
checkdep debuild devscripts
run_quiet "building $(basename $req)" do-build-deb $req
}
require-make()
{
if [[ ! -d "$1" ]]; then
echo "require-make: $1 not found"
exit 1
fi
local req=$(readlink -e "$1")
ktest_make_install+=("$req")
if [[ -n $BUILD_ON_HOST ]]; then
run_quiet "building $1" make -C "$req"
fi
}
require-kernel-config()
{
local OLDIFS=$IFS
IFS=','
for i in $1; do
ktest_kernel_config_require+=("$i")
done
IFS=$OLDIFS
}
require-qemu-append()
{
local OLDIFS=$IFS
IFS=','
for i in $1; do
ktest_kernel_config_require+=("$i")
done
IFS=$OLDIFS
}
require-kernel-append()
{
ktest_kernel_append+=($1)
}
config-scratch-devs()
{
ktest_scratch_devs+=("$1")
}
config-pmem-devs()
{
ktest_pmem_devs+=("$1")
}
config-image()
{
ktest_images+=("$1")
}
config-cpus()
{
ktest_cpus=$1
}
config-mem()
{
ktest_mem=$1
}
config-timeout()
{
n=$1
if [ "${EXTENDED_DEBUG:-0}" == 1 ]; then
n=$((n * 2))
fi
ktest_timeout=$n
}
pushd "$(dirname "$TESTPROG")" > /dev/null
. $(basename "$TESTPROG")
popd > /dev/null
if [ -z "$ktest_mem" ]; then
echo "test must specify config-mem"
exit 1
fi
if [ -z "$ktest_timeout" ]; then
echo "test must specify config-timeout"
exit 1
fi
}
|