blob: 9e4cbbd0d8b2114769a21afb2e877e1286c503b1 (
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
|
# function library for Comfignat's testcases
# Copyright 2013 - 2014 B. Persson, Bjorn@Rombobeorn.se
#
# This material is provided as is, with absolutely no warranty expressed
# or implied. Any use is at your own risk.
#
# Permission is hereby granted to use or copy this testsuite
# for any purpose, provided the above notices are retained on all copies.
# Permission to modify the code and to distribute modified code is granted,
# provided the above notices are retained, and a notice that the code was
# modified is included with the above copyright notice.
expect_configuration () {
# If "always" is passed, the testcase is always expected to leave a
# configuration file. If this is called without "always", a configuration
# file is expected only in a separate build directory.
if [ "$1" = always -o "${relative_builddir}" != . ] ; then
echo "${builddir}"/comfignat_configuration.mk >>"${file_list}"
fi
}
expect_generated_files () {
# The testcase is expected to generate files which are listed in the file
# generated_files, one per line. The lines may contain shell variable
# references. A line that expands into an empty string is ignored.
# A directory name may be passed as a parameter. The generated files will
# then be expected under that directory instead of the default staging
# directory.
# These directory variables mustn't be conveyed from Comfignat, because then
# the testsuite would rely on the same thing that it's supposed to test.
prefix=${prefix:-/usr/local}
exec_prefix=${exec_prefix:-${prefix}}
datarootdir=${datarootdir:-${prefix}/share}
bindir=${bindir:-${exec_prefix}/bin}
libexecdir=${libexecdir:-${exec_prefix}/libexec}
includedir=${includedir:-${prefix}/include}
libdir=${libdir:-${exec_prefix}/lib}
alidir=${alidir:-${libdir}}
gprdir=${gprdir:-${datarootdir}/gpr}
stagedir=${1:-stage}
stage_bindir=${stagedir}${bindir}
stage_libexecdir=${stagedir}${libexecdir}
stage_includedir=${stagedir}${includedir}
stage_libdir=${stagedir}${libdir}
stage_alidir=${stagedir}${alidir}
stage_gprdir=${stagedir}${gprdir}
cat "${srcdir}"/generated_files | while read line ; do
# Expand variables in the string to get the pathname.
eval file="${line}"
# Write the pathname and its parent directories to the file list.
# Chop off pathname components until only "." remains, but also avoid
# looping forever if the final residue turns out to be "/" or "//".
while [ -n "${file}" -a "${file}" != . -a "${file}" != / -a "${file}" != // ] ; do
echo "${builddir}/${file}" >>"${file_list}"
file=$(dirname "${file}")
done
done
}
common_setup () {
# When the locations file specifies a separate build directory, initialize
# the build directory and go there. When the source directory is also the
# build directory, just go to that directory.
cd "${srcdir}"
if [ "${relative_builddir}" != . ] ; then
echo "${builddir}"/Makefile >>"${file_list}"
make configure builddir="${relative_builddir}"
cd "${relative_builddir}"
fi
}
|