1 #!/bin/sh -- # no runable script, just for vi
5 # we all like colorful messages
6 if [ "$MSGCOLOR" != 'NO' ]; then
7 if ! expr match
"$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev
/null
; then
13 if [ "$MSGCOLOR" != 'NO' ]; then
14 CERROR
="\033[1;31m" # red
15 CWARNING
="\033[1;33m" # yellow
16 CMSG
="\033[1;32m" # green
17 CINFO
="\033[1;96m" # light blue
18 CDEBUG
="\033[1;94m" # blue
19 CNORMAL
="\033[0;39m" # default system console color
20 CDONE
="\033[1;32m" # green
21 CPASS
="\033[1;32m" # green
22 CFAIL
="\033[1;31m" # red
23 CCMD
="\033[1;35m" # pink
26 msgdie
() { echo "${CERROR}E: $1${CNORMAL}" >&2; exit 1; }
27 msgwarn
() { echo "${CWARNING}W: $1${CNORMAL}" >&2; }
28 msgmsg
() { echo "${CMSG}$1${CNORMAL}"; }
29 msginfo
() { echo "${CINFO}I: $1${CNORMAL}"; }
30 msgdebug
() { echo "${CDEBUG}D: $1${CNORMAL}"; }
31 msgdone
() { echo "${CDONE}DONE${CNORMAL}"; }
32 msgnwarn
() { echo -n "${CWARNING}W: $1${CNORMAL}" >&2; }
33 msgnmsg
() { echo -n "${CMSG}$1${CNORMAL}"; }
34 msgninfo
() { echo -n "${CINFO}I: $1${CNORMAL}"; }
35 msgndebug
() { echo -n "${CDEBUG}D: $1${CNORMAL}"; }
38 echo -n "${CINFO}$1${CCMD} "
39 echo -n "$(echo "$2" | sed -e 's#^apt\([cgfs]\)#apt-\1#')${CINFO} "
41 if [ -n "$1" ]; then shift; else break; fi
43 echo -n "…${CNORMAL} "
45 msgpass
() { echo "${CPASS}PASS${CNORMAL}"; }
46 msgskip
() { echo "${CWARNING}SKIP${CNORMAL}" >&2; }
48 if [ $# -gt 0 ]; then echo "${CFAIL}FAIL: $*${CNORMAL}" >&2;
49 else echo "${CFAIL}FAIL${CNORMAL}" >&2; fi
50 EXIT_CODE
=$((EXIT_CODE+1));
53 # enable / disable Debugging
54 MSGLEVEL
=${MSGLEVEL:-3}
55 if [ $MSGLEVEL -le 0 ]; then
58 if [ $MSGLEVEL -le 1 ]; then
62 if [ $MSGLEVEL -le 2 ]; then
66 msgpass
() { echo -n " ${CPASS}P${CNORMAL}"; }
67 msgskip
() { echo -n " ${CWARNING}S${CNORMAL}" >&2; }
68 if [ -n "$CFAIL" ]; then
69 msgfail
() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE
=$((EXIT_CODE+1)); }
71 msgfail
() { echo -n " ###FAILED###" >&2; EXIT_CODE
=$((EXIT_CODE+1)); }
74 if [ $MSGLEVEL -le 3 ]; then
78 if [ $MSGLEVEL -le 4 ]; then
83 if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] ||
84 [ "$1" = "info" -a $MSGLEVEL -le 3 ] ||
85 [ "$1" = "msg" -a $MSGLEVEL -le 2 ] ||
86 [ "$1" = "warn" -a $MSGLEVEL -le 1 ] ||
87 [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then
90 echo "${CDONE}DONE${CNORMAL}";
94 if [ -f .
/aptconfig.conf
]; then
95 echo "./aptconfig.conf"
96 elif [ -f ..
/aptconfig.conf
]; then
97 echo "../aptconfig.conf"
101 msgdebug
"Executing: ${CCMD}$*${CDEBUG} "
106 *) CMD
="${BUILDDIRECTORY}/$CMD";;
108 MALLOC_PERTURB_
=21 MALLOC_CHECK_
=2 APT_CONFIG
="$(getaptconfig)" LD_LIBRARY_PATH
=${BUILDDIRECTORY} $CMD "$@"
110 aptconfig
() { runapt apt
-config "$@"; }
111 aptcache
() { runapt apt
-cache "$@"; }
112 aptcdrom
() { runapt apt
-cdrom "$@"; }
113 aptget
() { runapt apt
-get "$@"; }
114 aptftparchive
() { runapt apt
-ftparchive "$@"; }
115 aptkey
() { runapt apt
-key "$@"; }
116 aptmark
() { runapt apt
-mark "$@"; }
117 aptsortpkgs
() { runapt apt
-sortpkgs "$@"; }
118 apt
() { runapt apt
"$@"; }
119 apthelper
() { runapt
"${APTHELPERBINDIR}/apt-helper" "$@"; }
120 aptwebserver
() { runapt
"${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
121 aptitude
() { runapt aptitude
"$@"; }
122 aptextracttemplates
() { runapt apt
-extracttemplates "$@"; }
125 command dpkg
--root=${TMPWORKINGDIRECTORY}/rootdir
--force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir
/var
/log
/dpkg.log
"$@"
127 dpkgcheckbuilddeps
() {
128 command dpkg
-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir
/var
/lib
/dpkg
"$@"
135 APT_CONFIG
=aptconfig.conf LD_LIBRARY_PATH
=${LIBRARYPATH} command gdb
${BUILDDIRECTORY}/$CMD --args ${BUILDDIRECTORY}/$CMD "$@"
138 # see apt-key for the whole trickery. Setup is done in setupenvironment
139 command gpg
--ignore-time-conflict --no-options --no-default-keyring \
140 --homedir "${TMPWORKINGDIRECTORY}/gnupghome" \
141 --no-auto-check-trustdb --trust-model always \
146 # error if we about to overflow, but ...
147 # "255 failures ought to be enough for everybody"
148 if [ $EXIT_CODE -gt 255 ]; then
149 msgdie
"Total failure count $EXIT_CODE too big"
151 exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
154 shellsetedetector
() {
156 if [ "$exit_status" != '0' ]; then
157 echo >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}"
158 if [ "$EXIT_CODE" = '0' ]; then
159 EXIT_CODE
="$exit_status"
165 if [ "$1" = 'prefix' ]; then
166 CURRENTTRAP
="$2 $CURRENTTRAP"
168 CURRENTTRAP
="$CURRENTTRAP $1"
170 trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
174 TMPWORKINGDIRECTORY
=$(mktemp -d)
175 TESTDIRECTORY
=$(readlink -f $(dirname $0))
176 msgninfo
"Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… "
178 # allow overriding the default BUILDDIR location
179 BUILDDIRECTORY
=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
180 LIBRARYPATH
=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
181 METHODSDIR
=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
182 APTHELPERBINDIR
=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
183 APTWEBSERVERBINDIR
=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
184 test -x "${BUILDDIRECTORY}/apt-get" || msgdie
"You need to build tree first"
187 addtrap
"cd /; rm -rf $TMPWORKINGDIRECTORY;"
188 cd $TMPWORKINGDIRECTORY
189 mkdir rootdir aptarchive keys
191 mkdir -p etc
/apt
/apt.conf.d etc
/apt
/sources.list.d etc
/apt
/trusted.gpg.d etc
/apt
/preferences.d
192 mkdir -p var
/cache var
/lib
/apt var
/log tmp
193 mkdir -p var
/lib
/dpkg
/info var
/lib
/dpkg
/updates var
/lib
/dpkg
/triggers
194 touch var
/lib
/dpkg
/available
196 ln -s ${METHODSDIR} usr
/lib
/apt
/methods
197 if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then
198 mkdir -p usr
/lib
/apt
/solvers
199 ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr
/lib
/apt
/solvers
/dump
200 ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr
/lib
/apt
/solvers
/apt
201 echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc
/apt
/apt.conf.d
/externalsolver.conf
203 # use the autoremove from the BUILDDIRECTORY if its there, otherwise
205 if [ -e ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove
]; then
206 ln -s ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove etc
/apt
/apt.conf.d
/01autoremove
208 ln -s /etc
/apt
/apt.conf.d
/01autoremove etc
/apt
/apt.conf.d
/01autoremove
211 local PACKAGESFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
212 if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
213 cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages
215 local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/')
216 if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then
217 cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive
/Sources
219 cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys
/
220 ln -s ${TMPWORKINGDIRECTORY}/keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
221 echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf
222 echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf
223 echo "Debug::NoLocking \"true\";" >> aptconfig.conf
224 echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf
225 echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf
226 echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf
227 echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf
228 echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
229 echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
230 echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
231 if ! command dpkg
--assert-multi-arch >/dev
/null
2>&1; then
232 echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf
# Added to test multiarch before dpkg is ready for it…
234 echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
235 echo 'quiet::NoUpdate "true";' >> aptconfig.conf
236 echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir
/etc
/apt
/apt.conf.d
/99https
237 echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir
/etc
/apt
/apt.conf.d
/apt
-binary
238 configcompression
'.' 'gz' #'bz2' 'lzma' 'xz'
240 # gpg needs a trustdb to function, but it can't be invalid (not even empty)
241 # see also apt-key where this trickery comes from:
242 local TRUSTDBDIR
="${TMPWORKINGDIRECTORY}/gnupghome"
244 chmod 700 "$TRUSTDBDIR"
245 # We also don't use a secret keyring, of course, but gpg panics and
246 # implodes if there isn't one available - and writeable for imports
247 local SECRETKEYRING
="${TRUSTDBDIR}/secring.gpg"
249 # now create the trustdb with an (empty) dummy keyring
250 # newer gpg versions are fine without it, but play it safe for now
251 gpg
--quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev
/null
2>&1
253 # cleanup the environment a bit
254 export PATH
="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
255 export LC_ALL
=C.UTF
-8
256 unset LANGUAGE APT_CONFIG
257 unset GREP_OPTIONS DEB_BUILD_PROFILES
263 if [ "$1" = "native" -o -z "$1" ]; then
264 eval `aptconfig shell ARCH APT::Architecture`
265 if [ -n "$ARCH" ]; then
268 dpkg
--print-architecture
276 echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
279 getarchitecturesfromcommalist
() {
280 echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/"
283 configarchitecture
() {
285 echo "APT::Architecture \"$(getarchitecture $1)\";"
286 while [ -n "$1" ]; do
287 echo "APT::Architectures:: \"$(getarchitecture $1)\";"
290 } >rootdir
/etc
/apt
/apt.conf.d
/01multiarch.conf
295 if [ ! -e rootdir
/var
/lib
/dpkg
/status
]; then
296 local STATUSFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/')
297 if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
298 cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
300 echo -n > rootdir/var/lib/dpkg/status
303 rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
304 if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
305 local ARCHS="$(getarchitectures)"
306 if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
307 DPKGARCH="$(dpkg --print-architecture)"
308 for ARCH in ${ARCHS}; do
309 if [ "${ARCH}" != "${DPKGARCH}" ]; then
310 if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
311 # old-style used e.g. in Ubuntu-P – and as it seems travis
312 echo "DPKG
::options
:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
313 echo "DPKG
::options
:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
317 if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
318 # dpkg doesn't really check the version as long as it is fully installed,
319 # but just to be sure we choose one above the required version
320 insertinstalledpackage 'dpkg' "all
" '1.16.2+fake'
326 configcompression() {
327 while [ -n "$1" ]; do
329 '.') echo ".
\t.
\tcat
";;
330 'gz') echo "gzip\tgz
\tgzip
";;
331 'bz2') echo "bzip2\tbz
2\tbzip
2";;
332 'lzma') echo "lzma
\tlzma
\txz
--format=lzma
";;
333 'xz') echo "xz
\txz
\txz
";;
334 *) echo "$1\t$1\t$1";;
337 done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf
340 setupsimplenativepackage() {
344 local RELEASE="${4:-unstable}"
345 local DEPENDENCIES="$5"
346 local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
347 If you
find such a package installed on your system
,
348 something went horribly wrong
! They are autogenerated
349 und used only by testcases and surf no other propose…
"}"
351 local SECTION
="${7:-others}"
353 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
356 DISTSECTION
="$(echo "$SECTION" | cut -d'/' -f 1)"
358 local BUILDDIR
=incoming
/${NAME}-${VERSION}
359 mkdir -p ${BUILDDIR}/debian
/source
361 echo "* most suckless software product ever" > FEATURES
362 test -e debian
/copyright
|| echo "Copyleft by Joe Sixpack $(date +%Y)" > debian
/copyright
363 test -e debian
/changelog
|| echo "$NAME ($VERSION) $RELEASE; urgency=low
367 -- Joe Sixpack <joe@example.org> $(date -R)" > debian
/changelog
368 test -e debian
/control
|| echo "Source: $NAME
371 Maintainer: Joe Sixpack <joe@example.org>
372 Build-Depends: debhelper (>= 7)
373 Standards-Version: 3.9.1
375 Package: $NAME" > debian
/control
376 if [ "$ARCH" = 'all' ]; then
377 echo "Architecture: all" >> debian
/control
379 echo "Architecture: any" >> debian
/control
381 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian
/control
382 echo "Description: $DESCRIPTION" >> debian
/control
384 test -e debian
/compat
|| echo "7" > debian
/compat
385 test -e debian
/source
/format
|| echo "3.0 (native)" > debian
/source
/format
386 test -e debian
/rules
|| cp /usr
/share
/doc
/debhelper
/examples
/rules.tiny debian
/rules
390 buildsimplenativepackage
() {
394 local RELEASE
="${4:-unstable}"
395 local DEPENDENCIES
="$5"
396 local DESCRIPTION
="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
397 If you find such a package installed on your system,
398 something went horribly wrong! They are autogenerated
399 und used only by testcases and surf no other propose…"}"
401 local SECTION="${7:-others}"
402 local PRIORITY="${8:-optional}"
404 local COMPRESS_TYPE="${10:-gzip}"
406 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
409 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
411 local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
413 msgninfo "Build package
${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}…
"
414 mkdir -p $BUILDDIR/debian/source
415 echo "* most suckless software product ever
" > ${BUILDDIR}/FEATURES
417 echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
419 echo "Copyleft by Joe Sixpack
$(date +%Y)" > ${BUILDDIR}/debian/copyright
420 echo "$NAME ($VERSION) $RELEASE; urgency
=low
424 -- Joe Sixpack
<joe@example.org
> $(date -R)" > ${BUILDDIR}/debian/changelog
428 Maintainer
: Joe Sixpack
<joe@example.org
>
429 Standards
-Version: 3.9.3" > ${BUILDDIR}/debian/control
430 local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
431 test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
433 Package
: $NAME" >> ${BUILDDIR}/debian/control
435 if [ "$ARCH" = 'all' ]; then
436 echo "Architecture
: all
" >> ${BUILDDIR}/debian/control
438 echo "Architecture
: any
" >> ${BUILDDIR}/debian/control
440 local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
441 test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
442 echo "Description
: $DESCRIPTION" >> ${BUILDDIR}/debian/control
444 echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
445 (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
447 echo "pool
/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
448 # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
449 # gpg --yes --secret-keyring ./keys/joesixpack.sec \
450 # --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \
451 # --clearsign -o "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
452 # mv "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
456 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
457 rm -rf ${BUILDDIR}/debian/tmp
458 mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
459 cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
460 cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}
461 if [ -n "$FILE_TREE" ]; then
462 cp -ar "$FILE_TREE" ${BUILDDIR}/debian/tmp
465 (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
466 (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
467 local LOG="${BUILDDIR}/..
/${NAME}_
${VERSION}_
${arch}.dpkg
-deb.log
"
468 # ensure the right permissions as dpkg-deb ensists
469 chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN
470 if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
475 echo "pool
/${NAME}_
${VERSION}_
${arch}.deb
" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
478 mkdir -p ${BUILDDIR}/../${NAME}_${VERSION}
479 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/
480 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog
489 local ARCH=$(getarchitecture $4)
490 local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')"
491 local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")"
492 msgninfo "Build package
${PKGNAME} for ${RELEASE} in ${SECTION}…
"
494 if [ "$ARCH" = "all
" ]; then
495 ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
497 if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then
501 local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")"
502 local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')"
505 echo "pool
/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist
508 echo "pool
/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist
514 if [ -d incoming ]; then
515 buildaptarchivefromincoming "$@
"
517 buildaptarchivefromfiles "$@
"
521 createaptftparchiveconfig() {
522 local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')"
523 COMPRESSORS="${COMPRESSORS%* }"
524 local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb
$#\
1#' | tr '\n' ' ')"
525 if [ -z "$ARCHS" ]; then
526 # the pool is empty, so we will operate on faked packages - let us use the configured archs
527 ARCHS
="$(getarchitectures)"
530 ArchiveDir "' >> ftparchive.conf
531 echo -n $(readlink -f .) >> ftparchive.conf
533 CacheDir "' >> ftparchive.conf
534 echo -n $(readlink -f ..) >> ftparchive.conf
536 FileListDir "' >> ftparchive.conf
537 echo -n $(readlink -f pool/) >> ftparchive.conf
541 Packages::Compress "'"$COMPRESSORS"'";
542 Sources::Compress "'"$COMPRESSORS"'";
543 Contents::Compress "'"$COMPRESSORS"'";
544 Translation::Compress "'"$COMPRESSORS"'";
545 LongDescription "false";
549 SrcDirectory "pool/";
555 Label "apttestcases";
557 Description "repository with dummy packages";
558 Architectures "' >> ftparchive.conf
559 echo -n "$ARCHS" >> ftparchive.conf
563 };' >> ftparchive.conf
564 for DIST
in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do
565 echo -n 'tree "dists/' >> ftparchive.conf
566 echo -n "$DIST" >> ftparchive.conf
568 Architectures "' >> ftparchive.conf
569 echo -n "$ARCHS" >> ftparchive.conf
571 FileList "' >> ftparchive.conf
572 echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf
574 SourceFileList "' >> ftparchive.conf
575 echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf
577 Sections "' >> ftparchive.conf
578 echo -n "$(find ./pool/ -maxdepth 1 -name "${DIST}.*.pkglist" -type f | cut -d'/' -f 3 | cut -d'.' -f 2 | sort | uniq | tr '\n' ' ')" >> ftparchive.conf
580 };' >> ftparchive.conf
584 buildaptftparchivedirectorystructure
() {
585 local DISTS
="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')"
586 for DIST
in $DISTS; do
587 local SECTIONS
="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)"
588 for SECTION
in $SECTIONS; do
589 local ARCHS
="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')"
590 for ARCH
in $ARCHS; do
591 mkdir -p dists
/${DIST}/${SECTION}/binary
-${ARCH}
593 mkdir -p dists
/${DIST}/${SECTION}/source
594 mkdir -p dists
/${DIST}/${SECTION}/i18n
604 local DEPENDENCIES
="$5"
605 local PRIORITY
="${6:-optional}"
606 local DESCRIPTION
="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
607 If you find such a package installed on your system,
608 something went horribly wrong! They are autogenerated
609 und used only by testcases and surf no other propose…"}"
611 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
612 if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
613 ARCHS="$(getarchitectures)"
617 for BUILDARCH in $ARCHS; do
618 local PPATH="aptarchive
/dists
/${RELEASE}/main
/binary
-${BUILDARCH}"
619 mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source
620 touch aptarchive/dists/${RELEASE}/main/source/Sources
621 local FILE="${PPATH}/Packages
"
626 Maintainer
: Joe Sixpack
<joe@example.org
>" >> $FILE
627 test "$arch" = 'none' || echo "Architecture
: $arch" >> $FILE
628 echo "Version
: $VERSION
629 Filename
: pool
/main
/${NAME}/${NAME}_
${VERSION}_
${arch}.deb
" >> $FILE
630 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
631 echo "Description
: $DESCRIPTION" >> $FILE
642 local DEPENDENCIES="$5"
644 local SPATH="aptarchive
/dists
/${RELEASE}/main
/source"
646 local FILE="${SPATH}/Sources
"
650 Maintainer
: Joe Sixpack
<joe@example.org
>
651 Architecture
: $ARCH" >> $FILE
652 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
654 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.dsc
655 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.
tar.gz
659 insertinstalledpackage() {
663 local DEPENDENCIES="$4"
664 local PRIORITY="${5:-optional}"
665 local STATUS="${6:-install ok installed}"
666 local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed
667 If you
find such a package installed on your system
,
668 something went horribly wrong
! They are autogenerated
669 und used only by testcases and surf no other propose…
"}"
671 local FILE
='rootdir/var/lib/dpkg/status'
672 local INFO
='rootdir/var/lib/dpkg/info'
673 for arch
in $(getarchitecturesfromcommalist "$ARCH"); do
679 Maintainer: Joe Sixpack <joe@example.org>
680 Version: $VERSION" >> $FILE
681 test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
682 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
683 echo "Description: $DESCRIPTION" >> $FILE
685 if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
686 echo -n > ${INFO}/${NAME}:${arch}.list
688 echo -n > ${INFO}/${NAME}.list
694 buildaptarchivefromincoming
() {
695 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
697 [ -e pool
] || ln -s ..
/incoming pool
698 [ -e ftparchive.conf
] || createaptftparchiveconfig
699 [ -e dists
] || buildaptftparchivedirectorystructure
700 msgninfo
"\tGenerate Packages, Sources and Contents files… "
701 aptftparchive
-qq generate ftparchive.conf
707 buildaptarchivefromfiles
() {
708 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
709 find aptarchive
-name 'Packages' -o -name 'Sources' | while read line
; do
710 msgninfo
"\t${line} file… "
711 compressfile
"$line" "$1"
714 generatereleasefiles
"$@"
718 cat ${TMPWORKINGDIRECTORY}/rootdir
/etc
/testcase
-compressor.conf
| while read compressor extension
command; do
719 if [ "$compressor" = '.' ]; then
725 cat "$1" | $command > "${1}.${extension}"
727 touch -d "$2" "${1}.${extension}"
732 # can be overridden by testcases for their pleasure
733 getcodenamefromsuite
() {
735 unstable
) echo 'sid';;
739 getreleaseversionfromsuite
() { true
; }
740 getlabelfromsuite
() { true
; }
742 generatereleasefiles
() {
743 # $1 is the Date header and $2 is the ValidUntil header to be set
744 # both should be given in notation date/touch can understand
745 msgninfo
"\tGenerate Release files… "
746 if [ -e aptarchive
/dists
]; then
747 for dir
in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
748 local SUITE
="$(echo "$dir" | cut -d'/' -f 4)"
749 local CODENAME
="$(getcodenamefromsuite $SUITE)"
750 local VERSION
="$(getreleaseversionfromsuite $SUITE)"
751 local LABEL
="$(getlabelfromsuite $SUITE)"
752 if [ -n "$VERSION" ]; then
753 VERSION
="-o APT::FTPArchive::Release::Version=${VERSION}"
755 if [ -n "$LABEL" ]; then
756 LABEL
="-o APT::FTPArchive::Release::Label=${LABEL}"
758 aptftparchive
-qq release
$dir \
759 -o APT
::FTPArchive
::Release
::Suite
="${SUITE}" \
760 -o APT
::FTPArchive
::Release
::Codename
="${CODENAME}" \
763 | sed -e '/0 Release$/ d' > $dir/Release
# remove the self reference
764 if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
766 NotAutomatic: yes' $dir/Release
768 if [ -n "$1" -a "$1" != "now" ]; then
769 sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release
773 Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release
777 aptftparchive
-qq release .
/aptarchive
| sed -e '/0 Release$/ d' > aptarchive
/Release
# remove the self reference
779 if [ -n "$1" -a "$1" != "now" ]; then
780 for release
in $(find ./aptarchive -name 'Release'); do
781 touch -d "$1" $release
787 setupdistsaptarchive
() {
788 local APTARCHIVE
=$(readlink -f ./aptarchive)
789 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb.list
790 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb-src.list
791 for DISTS
in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do
792 SECTIONS
=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ')
793 msgninfo
"\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… "
794 echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb.list
795 echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb-src.list
800 setupflataptarchive
() {
801 local APTARCHIVE
=$(readlink -f ./aptarchive)
802 if [ -f ${APTARCHIVE}/Packages
]; then
803 msgninfo
"\tadd deb sources.list line… "
804 echo "deb file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
807 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
809 if [ -f ${APTARCHIVE}/Sources
]; then
810 msgninfo
"\tadd deb-src sources.list line… "
811 echo "deb-src file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
814 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
820 if [ -e aptarchive
/dists
]; then
826 if [ "$1" != '--no-update' ]; then
827 msgninfo
"\tSync APT's cache with the archive… "
834 local SIGNER
="${1:-Joe Sixpack}"
835 local GPG
="gpg --batch --yes"
836 msgninfo
"\tSign archive with $SIGNER key… "
837 local REXKEY
='keys/rexexpired'
838 local SECEXPIREBAK
="${REXKEY}.sec.bak"
839 local PUBEXPIREBAK
="${REXKEY}.pub.bak"
840 if [ "${SIGNER}" = 'Rex Expired' ]; then
841 # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time
842 # option doesn't exist anymore (and using faketime would add a new obscure dependency)
843 # therefore we 'temporary' make the key not expired and restore a backup after signing
844 cp ${REXKEY}.sec
$SECEXPIREBAK
845 cp ${REXKEY}.pub
$PUBEXPIREBAK
846 local SECUNEXPIRED
="${REXKEY}.sec.unexpired"
847 local PUBUNEXPIRED
="${REXKEY}.pub.unexpired"
848 if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then
849 cp $SECUNEXPIRED ${REXKEY}.sec
850 cp $PUBUNEXPIRED ${REXKEY}.pub
852 printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub
--secret-keyring ${REXKEY}.sec
--command-fd 0 --edit-key "${SIGNER}" >/dev
/null
2>&1 || true
853 cp ${REXKEY}.sec
$SECUNEXPIRED
854 cp ${REXKEY}.pub
$PUBUNEXPIRED
857 for KEY
in $(find keys/ -name '*.sec'); do
858 GPG
="$GPG --secret-keyring $KEY"
860 for KEY
in $(find keys/ -name '*.pub'); do
861 GPG
="$GPG --keyring $KEY"
863 for RELEASE
in $(find aptarchive/ -name Release); do
864 $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg
${RELEASE}
865 local INRELEASE
="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')"
866 $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE
867 # we might have set a specific date for the Release file, so copy it
868 touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg
${INRELEASE}
870 if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then
871 mv -f $SECEXPIREBAK ${REXKEY}.sec
872 mv -f $PUBEXPIREBAK ${REXKEY}.pub
878 msgtest
"Set webserver config option '${1}' to" "$2"
879 local DOWNLOG
='rootdir/tmp/download-testfile.log'
880 local STATUS
='rootdir/tmp/webserverconfig.status'
881 rm -f "$STATUS" "$DOWNLOG"
882 if downloadfile
"http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then
885 cat "$DOWNLOG" "$STATUS"
888 testwebserverlaststatuscode
'200'
891 rewritesourceslist
() {
892 local APTARCHIVE
="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")"
893 for LIST
in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
894 sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#"
898 # wait for up to 10s for a pid file to appear to avoid possible race
899 # when a helper is started and dosn't write the PID quick enough
902 for i
in $(seq 10); do
903 if test -s "$PIDFILE"; then
908 msgdie
"waiting for $PIDFILE failed"
912 changetowebserver
() {
913 if [ "$1" != '--no-rewrite' ]; then
914 rewritesourceslist
'http://localhost:8080/'
918 if test -x ${APTWEBSERVERBINDIR}/aptwebserver
; then
920 local LOG
="webserver.log"
921 if ! aptwebserver
-o aptwebserver
::fork
=1 "$@" >$LOG 2>&1 ; then
925 waitforpidfile aptwebserver.pid
926 local PID
="$(cat aptwebserver.pid)"
927 if [ -z "$PID" ]; then
928 msgdie
'Could not fork aptwebserver successfully'
933 msgdie
'You have to build aptwerbserver or install a webserver'
937 changetohttpswebserver
() {
938 if ! which stunnel4
>/dev
/null
; then
939 msgdie
'You need to install stunnel4 for https testcases'
941 if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
942 changetowebserver
--no-rewrite "$@"
944 echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
945 cert = ${TESTDIRECTORY}/apt.pem
951 " > ${TMPWORKINGDIRECTORY}/stunnel.conf
952 stunnel4
"${TMPWORKINGDIRECTORY}/stunnel.conf"
953 waitforpidfile
"${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid"
954 local PID
="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)"
955 if [ -z "$PID" ]; then
956 msgdie
'Could not fork stunnel4 successfully'
958 addtrap
'prefix' "kill ${PID};"
959 rewritesourceslist
'https://localhost:4433/'
963 mkdir -p rootdir
/media
/cdrom
/.disk
964 local CD
="$(readlink -f rootdir/media/cdrom)"
965 echo "acquire::cdrom::mount \"${CD}\";
966 acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\";
967 acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\";
968 acquire::cdrom::autodetect 0;" > rootdir
/etc
/apt
/apt.conf.d
/00cdrom
969 echo -n "$1" > ${CD}/.disk
/info
970 if [ ! -d aptarchive
/dists
]; then
971 msgdie
'Flat file archive cdroms can not be created currently'
974 mv aptarchive
/dists
"$CD"
975 ln -s "$(readlink -f ./incoming)" $CD/pool
976 find rootdir
/etc
/apt
/sources.list.d
/ -name 'apt-test-*.list' -delete
977 # start with an unmounted disk
978 mv "${CD}" "${CD}-unmounted"
979 # we don't want the disk to be modifiable
980 addtrap
'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;"
981 chmod -R -w rootdir
/media
/cdrom
-unmounted/dists
985 local PROTO
="$(echo "$1" | cut -d':' -f 1 )"
986 apthelper
-o Debug
::Acquire
::${PROTO}=1 \
987 download
-file "$1" "$2" 2>&1 || true
988 # only if the file exists the download was successful
997 local DIFFTEXT
="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
998 if [ -n "$DIFFTEXT" ]; then
1000 echo >&2 "$DIFFTEXT"
1010 msgtest
"Test for correctness of file" "$FILE"
1011 if [ -z "$*" ]; then
1012 echo -n "" | checkdiff
$FILE - && msgpass
|| msgfail
1014 echo "$*" | checkdiff
$FILE - && msgpass
|| msgfail
1019 msgtest
"Test for no output of" "$*"
1020 test -z "$($* 2>&1)" && msgpass
|| msgfail
1024 local MSG
='Test of equality of'
1025 if [ "$1" = '--nomsg' ]; then
1030 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile"
1031 echo "$1" > $COMPAREFILE
1034 if [ -n "$MSG" ]; then
1037 $
* 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1041 local COMPAREFILE1
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
1042 local COMPAREFILE2
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
1043 local COMPAREAGAINST
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
1044 echo "$1" > $COMPAREFILE1
1045 echo "$2" > $COMPAREFILE2
1047 msgtest
"Test for equality OR of" "$*"
1048 $
* >$COMPAREAGAINST 2>&1 || true
1049 if checkdiff
$COMPAREFILE1 $COMPAREAGAINST >/dev
/null
2>&1 || \
1050 checkdiff
$COMPAREFILE2 $COMPAREAGAINST >/dev
/null
2>&1
1054 echo -n "\n${CINFO}Diff against OR 1${CNORMAL}"
1055 checkdiff
$COMPAREFILE1 $COMPAREAGAINST || true
1056 echo -n "${CINFO}Diff against OR 2${CNORMAL}"
1057 checkdiff
$COMPAREFILE2 $COMPAREAGAINST || true
1063 local VIRTUAL
="N: Can't select versions from package '$1' as it is purely virtual"
1066 while [ -n "$1" ]; do
1068 N: Can't select versions from package '$1' as it is purely virtual"
1069 PACKAGE
="${PACKAGE} $1"
1072 msgtest
"Test for virtual packages" "apt-cache show $PACKAGE"
1074 N: No packages found"
1075 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile"
1076 local ARCH
="$(getarchitecture 'native')"
1077 echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
1078 aptcache show
-q=0 $PACKAGE 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1082 msgtest
"Test for non-existent packages" "apt-cache show $*"
1083 local SHOWPKG
="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
1084 if [ -n "$SHOWPKG" ]; then
1093 testdpkginstalled
() {
1094 msgtest
"Test for correctly installed package(s) with" "dpkg -l $*"
1095 local PKGS
="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)"
1096 if [ "$PKGS" != $# ]; then
1098 dpkg
-l "$@" | grep '^[a-z]' >&2
1105 testdpkgnotinstalled
() {
1106 msgtest
"Test for correctly not-installed package(s) with" "dpkg -l $*"
1107 local PKGS
="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)"
1108 if [ "$PKGS" != 0 ]; then
1110 dpkg
-l "$@" | grep '^[a-z]' >&2
1118 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
1119 if [ -n "$1" ]; then
1120 msgtest
'Test for correctly marked as auto-installed' "$*"
1121 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
1123 msgtest
'Test for correctly marked as auto-installed' 'no package'
1124 echo -n > $COMPAREFILE
1126 aptmark showauto
2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1130 if [ "$1" = '--nomsg' ]; then
1133 msgtest
'Test for successful execution of' "$*"
1135 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
1136 if $@
>${OUTPUT} 2>&1; then
1146 if [ "$1" = '--nomsg' ]; then
1149 msgtest
'Test for failure in execution of' "$*"
1151 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
1152 if $@
>${OUTPUT} 2>&1; then
1161 testwebserverlaststatuscode
() {
1162 local DOWNLOG
='rootdir/tmp/webserverstatus-testfile.log'
1163 local STATUS
='rootdir/tmp/webserverstatus-statusfile.log'
1164 rm -f "$DOWNLOG" "$STATUS"
1165 msgtest
'Test last status code from the webserver was' "$1"
1166 downloadfile
"http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
1167 if [ "$(cat "$STATUS")" = "$1" ]; then
1171 if [ -n "$2" ]; then
1173 echo >&2 '#### Additionally provided output files contain:'
1176 echo >&2 '#### Download log of the status code:'
1178 msgfail
"Status was $(cat "$STATUS")"
1183 echo "STOPPED execution. Press enter to continue"