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