]> git.saurik.com Git - apt.git/blob - test/libapt/run-tests
fix crash when P.Arch() was used but the cache got remapped
[apt.git] / test / libapt / run-tests
1 #!/bin/sh
2 set -e
3
4 DIR=$(readlink -f $(dirname $0))
5 echo "Compiling the tests …"
6 test -d "$DIR/../../build/obj/test/libapt/" || mkdir -p "$DIR/../../build/obj/test/libapt/"
7 (cd $DIR && make)
8 echo "Running all testcases …"
9 LDPATH="$DIR/../../build/bin"
10 EXT="_libapt_test"
11 for testapp in $(ls ${LDPATH}/*$EXT)
12 do
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 mkdir "${tmppath}/invaliddir" \
43 "${tmppath}/directory.conf" \
44 "${tmppath}/directory.list" \
45 "${tmppath}/directory.wron" \
46 "${tmppath}/directory.list.disabled"
47 ln -s "${tmppath}/anormalfile" "${tmppath}/linkedfile.list"
48 ln -s "${tmppath}/non-existing-file" "${tmppath}/brokenlink.list"
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"
56 elif [ $name = "HashSums${EXT}" ]; then
57 TMP="$(mktemp)"
58 dmesg > $TMP
59 echo -n "Testing with \033[1;35m${name}\033[0m ... "
60 LD_LIBRARY_PATH=${LDPATH} ${testapp} $TMP $(md5sum $TMP | cut -d' ' -f 1) $(sha1sum $TMP | cut -d' ' -f 1) $(sha256sum $TMP | cut -d' ' -f 1) $(sha512sum $TMP | cut -d' ' -f 1) && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
61 rm $TMP
62 continue
63 fi
64
65 echo -n "Testing with \033[1;35m${name}\033[0m ... "
66 LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
67
68 if [ -n "$tmppath" -a -d "$tmppath" ]; then
69 echo "Cleanup Testarea after \033[1;35m$name\033[0m ..."
70 rm -rf "$tmppath"
71 fi
72
73 done