]>
git.saurik.com Git - apt.git/blob - test/libapt/run-tests
4 DIR
=$(readlink -f $(dirname $0))
5 echo "Compiling the tests …"
7 echo "Running all testcases …"
8 LDPATH
="$DIR/../../build/bin"
12 # detect if output is on a terminal (colorful) or better not
13 if expr match
"$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev
/null
; then
16 TESTOKAY
='\033[1;32mOKAY\033[0m'
17 TESTFAIL
='\033[1;31mFAILED\033[0m'
22 TESTFAIL
='###FAILED###'
25 for testapp
in $(ls ${LDPATH}/*$EXT)
27 name
=$(basename ${testapp})
28 NAME
="${COLHIGH}${name}${COLRESET}"
31 if [ $name = "GetListOfFilesInDir${EXT}" ]; then
32 # TODO: very-low: move env creation to the actual test-app
34 touch "${tmppath}/anormalfile" \
35 "${tmppath}/01yet-anothernormalfile" \
36 "${tmppath}/anormalapt.conf" \
37 "${tmppath}/01yet-anotherapt.conf" \
38 "${tmppath}/anormalapt.list" \
39 "${tmppath}/01yet-anotherapt.list" \
40 "${tmppath}/wrongextension.wron" \
41 "${tmppath}/wrong-extension.wron" \
42 "${tmppath}/strangefile." \
43 "${tmppath}/s.t.r.a.n.g.e.f.i.l.e" \
44 "${tmppath}/.hiddenfile" \
45 "${tmppath}/.hiddenfile.conf" \
46 "${tmppath}/.hiddenfile.list" \
47 "${tmppath}/multi..dot" \
48 "${tmppath}/multi.dot.conf" \
49 "${tmppath}/multi.dot.list" \
50 "${tmppath}/disabledfile.disabled" \
51 "${tmppath}/disabledfile.conf.disabled" \
52 "${tmppath}/disabledfile.list.disabled" \
53 "${tmppath}/invälid.conf" \
54 "${tmppath}/invalíd" \
55 "${tmppath}/01invalíd"
56 mkdir "${tmppath}/invaliddir" \
57 "${tmppath}/directory.conf" \
58 "${tmppath}/directory.list" \
59 "${tmppath}/directory.wron" \
60 "${tmppath}/directory.list.disabled"
61 ln -s "${tmppath}/anormalfile" "${tmppath}/linkedfile.list"
62 ln -s "${tmppath}/non-existing-file" "${tmppath}/brokenlink.list"
63 elif [ $name = "getLanguages${EXT}" ]; then
65 touch "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tr" \
66 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-pt" \
67 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-se~" \
68 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak" \
69 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE" \
70 "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tlh%5fDE"
71 elif [ $name = "HashSums${EXT}" ]; then
72 TMP
="$(readlink -f "./${0}")"
73 echo -n "Testing with ${NAME} "
74 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 "$TESTOKAY" || echo "$TESTFAIL"
76 elif [ $name = "CompareVersion${EXT}" ]; then
77 tmppath
="${DIR}/versions.lst"
78 elif [ $name = "CdromFindPackages${EXT}" ]; then
80 mkdir -p "${tmppath}/.disk" "${tmppath}/pool" \
81 "${tmppath}/dists/stable/main/binary-i386" \
82 "${tmppath}/dists/stable/main/source" \
83 "${tmppath}/dists/stable/contrib/binary-amd64" \
84 "${tmppath}/dists/stable/contrib/binary-all" \
85 "${tmppath}/dists/unstable/main/binary-i386" \
86 "${tmppath}/dists/unstable/main/i18n" \
87 "${tmppath}/dists/unstable/main/source" \
88 "${tmppath}/dists/broken/non-free/source"
89 touch "${tmppath}/dists/broken/.aptignr" \
90 "${tmppath}/dists/stable/main/binary-i386/Packages" \
91 "${tmppath}/dists/stable/main/binary-i386/Packages.bz2" \
92 "${tmppath}/dists/stable/main/source/Sources.xz" \
93 "${tmppath}/dists/stable/contrib/binary-amd64/Packages" \
94 "${tmppath}/dists/stable/contrib/binary-amd64/Packages.gz" \
95 "${tmppath}/dists/stable/contrib/binary-all/Packages" \
96 "${tmppath}/dists/unstable/main/binary-i386/Packages.xz" \
97 "${tmppath}/dists/unstable/main/binary-i386/Packages.lzma" \
98 "${tmppath}/dists/unstable/main/i18n/Translation-en" \
99 "${tmppath}/dists/unstable/main/i18n/Translation-de.bz2" \
100 "${tmppath}/dists/unstable/main/source/Sources.xz" \
101 "${tmppath}/dists/broken/non-free/source/Sources.gz" \
102 "${tmppath}/dists/stable/Release.gpg" \
103 "${tmppath}/dists/stable/Release" \
104 "${tmppath}/dists/unstable/InRelease" \
105 "${tmppath}/dists/broken/Release.gpg"
106 ln -s "${tmppath}/dists/unstable" "${tmppath}/dists/sid"
109 echo -n "Testing with ${NAME} "
110 if LD_LIBRARY_PATH
=${LDPATH} ${testapp} ${tmppath} ; then
117 if [ -n "$tmppath" -a -d "$tmppath" ]; then