]> git.saurik.com Git - apt.git/blame - test/libapt/run-tests
add wrapper around dpkg to be able to use it easily in the tests
[apt.git] / test / libapt / run-tests
CommitLineData
e4a30974 1#!/bin/sh
e29a6bb1
DK
2set -e
3
f6bfb482
DK
4local DIR=$(readlink -f $(dirname $0))
5echo "Compiling the tests …"
6test -d "$DIR/../../build/obj/test/libapt/" || mkdir -p "$DIR/../../build/obj/test/libapt/"
7$(cd $DIR && make)
8echo "Running all testcases …"
9LDPATH="$DIR/../../build/bin"
e29a6bb1
DK
10EXT="_libapt_test"
11for testapp in $(ls ${LDPATH}/*$EXT)
e4a30974 12do
e29a6bb1
DK
13 name=$(basename ${testapp})
14 tmppath=""
15
16 if [ $name = "GetListOfFilesInDir${EXT}" ]; then
17 # TODO: very-low: move env creation to the actual test-app
18 echo "Prepare Testarea for \033[1;35m$name\033[0m ..."
19 tmppath=$(mktemp -d)
20 touch "${tmppath}/anormalfile" \
21 "${tmppath}/01yet-anothernormalfile" \
22 "${tmppath}/anormalapt.conf" \
23 "${tmppath}/01yet-anotherapt.conf" \
24 "${tmppath}/anormalapt.list" \
25 "${tmppath}/01yet-anotherapt.list" \
26 "${tmppath}/wrongextension.wron" \
27 "${tmppath}/wrong-extension.wron" \
28 "${tmppath}/strangefile." \
29 "${tmppath}/s.t.r.a.n.g.e.f.i.l.e" \
30 "${tmppath}/.hiddenfile" \
31 "${tmppath}/.hiddenfile.conf" \
32 "${tmppath}/.hiddenfile.list" \
33 "${tmppath}/multi..dot" \
34 "${tmppath}/multi.dot.conf" \
35 "${tmppath}/multi.dot.list" \
36 "${tmppath}/disabledfile.disabled" \
37 "${tmppath}/disabledfile.conf.disabled" \
38 "${tmppath}/disabledfile.list.disabled" \
39 "${tmppath}/invälid.conf" \
40 "${tmppath}/invalíd" \
41 "${tmppath}/01invalíd"
42 ln -s "${tmppath}/anormalfile" "${tmppath}/linkedfile.list"
43 ln -s "${tmppath}/non-existing-file" "${tmppath}/brokenlink.list"
3f2d77b5
DK
44 elif [ $name = "getLanguages${EXT}" ]; then
45 echo "Prepare Testarea for \033[1;35m$name\033[0m ..."
46 tmppath=$(mktemp -d)
47 touch "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tr" \
48 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-pt" \
49 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-se~" \
50 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak"
e29a6bb1
DK
51 fi
52
53 echo -n "Testing with \033[1;35m${name}\033[0m ... "
54 LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
55
56 if [ -n "$tmppath" -a -d "$tmppath" ]; then
57 echo "Cleanup Testarea after \033[1;35m$name\033[0m ..."
58 rm -rf "$tmppath"
59 fi
60
e4a30974 61done