aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.sh
diff options
context:
space:
mode:
authorhisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c>2009-04-01 17:11:57 +0000
committerhisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c>2009-04-01 17:11:57 +0000
commita88d6f2eeba2b3355c33fac6d736cf6086342f47 (patch)
tree03ebfa0ced0186e091609cf337e290580fab8c11 /test/run_tests.sh
downloadluarocks-a88d6f2eeba2b3355c33fac6d736cf6086342f47.tar.gz
luarocks-a88d6f2eeba2b3355c33fac6d736cf6086342f47.tar.bz2
luarocks-a88d6f2eeba2b3355c33fac6d736cf6086342f47.zip
Import latest revision from CVS at luaforge.netv1.0v0.5.2v0.5.1v0.5v0.4.3v0.4.2v0.4.1v0.4v0.3.2v0.3.1v0.3v0.2v0.1
git-svn-id: http://luarocks.org/svn/luarocks/trunk@1 9ca3f7c1-7366-0410-b1a3-b5c78f85698c
Diffstat (limited to 'test/run_tests.sh')
-rwxr-xr-xtest/run_tests.sh76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/run_tests.sh b/test/run_tests.sh
new file mode 100755
index 00000000..aa06854f
--- /dev/null
+++ b/test/run_tests.sh
@@ -0,0 +1,76 @@
1#!/bin/bash
2
3if [ -e ./run_tests.sh ]
4then
5 cd ../src
6elif [ -d src ]
7then
8 cd src
9elif ! [ -d luarocks ]
10then
11 echo "Go to the src directory and run this."
12 exit 1
13fi
14
15if [ ! -d ../rocks ]
16then
17 echo "Downloading entire rocks repository for tests"
18 cd ..
19 wget -r -nH -np -R"index.*" http://luarocks.luaforge.net/rocks/
20 cd src
21fi
22
23rocks=(
24 `ls ../rocks/*.rockspec | grep -v luacom`
25 `ls ../rocks/*.src.rock | grep -v luacom`
26)
27
28bin/luarocks-admin make-manifest ../rocks || exit 1
29
30[ "$1" ] && rocks=("$1")
31
32TRY() {
33 "$@" || {
34 echo "Failed running: $@"
35 exit 1
36 }
37}
38
39list_search() {
40 bin/luarocks list $name | grep $version
41}
42
43for rock in "${rocks[@]}"
44do
45 base=`basename $rock`
46 baserockspec=`basename $rock .rockspec`
47 basesrcrock=`basename $rock .src.rock`
48 if [ "$base" != "$baserockspec" ]
49 then
50 base=$baserockspec
51 name=`echo $base | sed 's/\(.*\)-[^-]*-[^-]*$/\1/'`
52 version=`echo $base | sed 's/.*-\([^-]*-[^-]*\)$/\1/'`
53 TRY bin/luarocks pack $rock
54 TRY bin/luarocks build $base.src.rock
55 TRY rm $base.src.rock
56 else
57 base=$basesrcrock
58 name=`echo $base | sed 's/\(.*\)-[^-]*-[^-]*$/\1/'`
59 version=`echo $base | sed 's/.*-\([^-]*-[^-]*\)$/\1/'`
60 TRY bin/luarocks build $rock
61 fi
62 TRY bin/luarocks pack $name $version
63 TRY bin/luarocks install $base.*.rock
64 TRY rm $base.*.rock
65 TRY list_search $name $version
66 bin/luarocks remove $name $version
67 # TODO: differentiate between error and dependency block.
68done
69
70if bin/luarocks install nonexistant | grep "No results"
71then echo "OK, got expected error."
72else exit 1
73fi
74
75TRY ../test/test_deps.lua
76TRY ../test/test_require.lua