]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | set -e | |
3 | ||
4 | DIR=$(readlink -f $(dirname $0)) | |
5 | echo "Compiling the tests …" | |
6 | (cd $DIR && make) | |
7 | echo "Running all testcases …" | |
8 | LDPATH="$DIR/../../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 | mkdir "${tmppath}/invaliddir" \ | |
42 | "${tmppath}/directory.conf" \ | |
43 | "${tmppath}/directory.list" \ | |
44 | "${tmppath}/directory.wron" \ | |
45 | "${tmppath}/directory.list.disabled" | |
46 | ln -s "${tmppath}/anormalfile" "${tmppath}/linkedfile.list" | |
47 | ln -s "${tmppath}/non-existing-file" "${tmppath}/brokenlink.list" | |
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" | |
55 | elif [ $name = "CompareVersion${EXT}" ]; then | |
56 | tmppath="${DIR}/versions.lst" | |
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 | ||
67 | done |