]> git.saurik.com Git - apt.git/blob - test/libapt/run-tests.sh
merged from lp:~donkult/apt/sid
[apt.git] / test / libapt / run-tests.sh
1 #!/bin/sh
2 set -e
3
4 echo "Compiling the tests ..."
5 test -d '../../build/obj/test/libapt/' || mkdir -p '../../build/obj/test/libapt/'
6 make
7 echo "Running all testcases ..."
8 LDPATH=$(pwd)/../../build/bin
9 EXT="_libapt_test"
10 for testapp in $(ls ${LDPATH}/*$EXT)
11 do
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"
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"
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
60 done