]> git.saurik.com Git - apt.git/blame - test/libapt/run-tests
merged from donkult and fix dashish
[apt.git] / test / libapt / run-tests
CommitLineData
e4a30974 1#!/bin/sh
e29a6bb1
DK
2set -e
3
47f9af4f 4DIR=$(readlink -f $(dirname $0))
f6bfb482
DK
5echo "Compiling the tests …"
6test -d "$DIR/../../build/obj/test/libapt/" || mkdir -p "$DIR/../../build/obj/test/libapt/"
1c493315 7(cd $DIR && make)
f6bfb482
DK
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"
491058e3
DK
42 mkdir "${tmppath}/invaliddir" \
43 "${tmppath}/directory.conf" \
44 "${tmppath}/directory.list" \
45 "${tmppath}/directory.wron" \
46 "${tmppath}/directory.list.disabled"
e29a6bb1
DK
47 ln -s "${tmppath}/anormalfile" "${tmppath}/linkedfile.list"
48 ln -s "${tmppath}/non-existing-file" "${tmppath}/brokenlink.list"
3f2d77b5
DK
49 elif [ $name = "getLanguages${EXT}" ]; then
50 echo "Prepare Testarea for \033[1;35m$name\033[0m ..."
51 tmppath=$(mktemp -d)
52 touch "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tr" \
53 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-pt" \
54 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-se~" \
55 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak"
e29a6bb1
DK
56 fi
57
58 echo -n "Testing with \033[1;35m${name}\033[0m ... "
59 LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
60
61 if [ -n "$tmppath" -a -d "$tmppath" ]; then
62 echo "Cleanup Testarea after \033[1;35m$name\033[0m ..."
63 rm -rf "$tmppath"
64 fi
65
e4a30974 66done