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