aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-23 22:02:11 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-23 22:05:02 +0200
commit64e5a64442194a73e75ef11039f7d1e18d60c15e (patch)
treeab8f11613158d54302cc04bcab99cc4af3036af4 /test
parent082ffbd3d6e713ba8c24b428c46af30c799aac6b (diff)
downloadaports-64e5a64442194a73e75ef11039f7d1e18d60c15e.tar.bz2
aports-64e5a64442194a73e75ef11039f7d1e18d60c15e.tar.xz
test: rewrite the testing framework to use the real applets
also merge the expected output to the *.test files.
Diffstat (limited to 'test')
-rw-r--r--test/basic1.expect2
-rw-r--r--test/basic1.test9
-rw-r--r--test/basic2.expect0
-rw-r--r--test/basic2.test9
-rw-r--r--test/basic3.expect2
-rw-r--r--test/basic3.test11
-rw-r--r--test/basic4.expect1
-rw-r--r--test/basic4.test10
-rw-r--r--test/basic5.expect2
-rw-r--r--test/basic5.test11
-rw-r--r--test/basic6.expect0
-rw-r--r--test/basic6.test9
-rw-r--r--test/basic7.expect0
-rw-r--r--test/basic7.test10
-rw-r--r--test/complicated1.expect4
-rw-r--r--test/complicated1.test11
-rw-r--r--test/complicated2.expect3
-rw-r--r--test/complicated2.test10
-rw-r--r--test/complicated3.expect2
-rw-r--r--test/complicated3.test9
-rw-r--r--test/complicated4.expect4
-rw-r--r--test/complicated4.test13
-rw-r--r--test/conflict.repo2
-rw-r--r--test/conflict1.expect2
-rw-r--r--test/conflict1.test7
-rw-r--r--test/conflict2.expect2
-rw-r--r--test/conflict2.test6
-rw-r--r--test/error1.expect2
-rw-r--r--test/error1.test8
-rw-r--r--test/error2.expect2
-rw-r--r--test/error2.test8
-rw-r--r--test/error3.expect2
-rw-r--r--test/error3.test8
-rw-r--r--test/error4.expect2
-rw-r--r--test/error4.test8
-rw-r--r--test/error5.expect2
-rw-r--r--test/error5.test8
-rw-r--r--test/installif1.expect4
-rw-r--r--test/installif1.test11
-rw-r--r--test/installif2.expect6
-rw-r--r--test/installif2.test13
-rw-r--r--test/installif3.expect4
-rw-r--r--test/installif3.test12
-rw-r--r--test/pinning1.expect2
-rw-r--r--test/pinning1.test10
-rw-r--r--test/pinning2.expect2
-rw-r--r--test/pinning2.test10
-rw-r--r--test/pinning3.expect2
-rw-r--r--test/pinning3.test10
-rw-r--r--test/pinning4.expect3
-rw-r--r--test/pinning4.test11
-rwxr-xr-xtest/solver.sh22
52 files changed, 208 insertions, 115 deletions
diff --git a/test/basic1.expect b/test/basic1.expect
deleted file mode 100644
index 81756fee50..0000000000
--- a/test/basic1.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Installing b (2)
-Installing a (2)
diff --git a/test/basic1.test b/test/basic1.test
index b3a4bb7c88..b906cc41e8 100644
--- a/test/basic1.test
+++ b/test/basic1.test
@@ -1,2 +1,7 @@
---raw-repository basic.repo
-a
+@ARGS
+--test-repo basic.repo
+add a
+@EXPECT
+(1/2) Installing b (2)
+(2/2) Installing a (2)
+OK: 0 MiB in 0 packages
diff --git a/test/basic2.expect b/test/basic2.expect
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/basic2.expect
+++ /dev/null
diff --git a/test/basic2.test b/test/basic2.test
index 75b172c134..e89d0ddee6 100644
--- a/test/basic2.test
+++ b/test/basic2.test
@@ -1,2 +1,7 @@
---raw-repository basic.repo --installed basic.installed
-a
+@ARGS
+--test-repo basic.repo
+--test-instdb basic.installed
+--test-world a
+add
+@EXPECT
+OK: 0 MiB in 2 packages
diff --git a/test/basic3.expect b/test/basic3.expect
deleted file mode 100644
index 73bef160d7..0000000000
--- a/test/basic3.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Upgrading b (1 -> 2)
-Upgrading a (1 -> 2)
diff --git a/test/basic3.test b/test/basic3.test
index 0a790a47d1..9efee6bf0e 100644
--- a/test/basic3.test
+++ b/test/basic3.test
@@ -1,2 +1,9 @@
---raw-repository basic.repo --installed basic.installed -u
-a
+@ARGS
+--test-repo basic.repo
+--test-instdb basic.installed
+--test-world a
+upgrade
+@EXPECT
+(1/2) Upgrading b (1 -> 2)
+(2/2) Upgrading a (1 -> 2)
+OK: 0 MiB in 2 packages
diff --git a/test/basic4.expect b/test/basic4.expect
deleted file mode 100644
index 9dacff1d4f..0000000000
--- a/test/basic4.expect
+++ /dev/null
@@ -1 +0,0 @@
-Purging a (1)
diff --git a/test/basic4.test b/test/basic4.test
index b12d9cfdb9..906c1e97a6 100644
--- a/test/basic4.test
+++ b/test/basic4.test
@@ -1,2 +1,8 @@
---raw-repository basic.repo --installed basic.installed
-b
+@ARGS
+--test-repo basic.repo
+--test-instdb basic.installed
+--test-world "a b"
+del a
+@EXPECT
+(1/1) Purging a (1)
+OK: 0 MiB in 2 packages
diff --git a/test/basic5.expect b/test/basic5.expect
deleted file mode 100644
index b29db179bd..0000000000
--- a/test/basic5.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Replacing b (2 -> 2)
-Replacing a (2 -> 2)
diff --git a/test/basic5.test b/test/basic5.test
index 40bf72ab96..854f5e79df 100644
--- a/test/basic5.test
+++ b/test/basic5.test
@@ -1,2 +1,9 @@
---raw-repository basic.repo --installed basic.installed2 -a
-a
+@ARGS
+--test-repo basic.repo
+--test-instdb basic.installed2
+--test-world a
+upgrade -a
+@EXPECT
+(1/2) Replacing b (2 -> 2)
+(2/2) Replacing a (2 -> 2)
+OK: 0 MiB in 2 packages
diff --git a/test/basic6.expect b/test/basic6.expect
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/basic6.expect
+++ /dev/null
diff --git a/test/basic6.test b/test/basic6.test
index d9fbe64d1c..6914767bb6 100644
--- a/test/basic6.test
+++ b/test/basic6.test
@@ -1,2 +1,7 @@
---raw-repository basic.repo --installed basic.installed2
-a
+@ARGS
+--test-repo basic.repo
+--test-instdb basic.installed2
+--test-world a
+upgrade
+@EXPECT
+OK: 0 MiB in 2 packages
diff --git a/test/basic7.expect b/test/basic7.expect
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/basic7.expect
+++ /dev/null
diff --git a/test/basic7.test b/test/basic7.test
index c53d2d2f07..a1f153a931 100644
--- a/test/basic7.test
+++ b/test/basic7.test
@@ -1,2 +1,8 @@
---no-network --raw-repository basic.repo --installed basic.installed -u
-a
+@ARGS
+--no-network
+--test-repo basic.repo
+--test-instdb basic.installed
+--test-world a
+upgrade
+@EXPECT
+OK: 0 MiB in 2 packages
diff --git a/test/complicated1.expect b/test/complicated1.expect
deleted file mode 100644
index 1387f53ae7..0000000000
--- a/test/complicated1.expect
+++ /dev/null
@@ -1,4 +0,0 @@
-Installing d (1.5)
-Installing c (1)
-Installing b (1)
-Installing a (2)
diff --git a/test/complicated1.test b/test/complicated1.test
index 070f2e17fc..53ea08a309 100644
--- a/test/complicated1.test
+++ b/test/complicated1.test
@@ -1,2 +1,9 @@
---raw-repository complicated1.repo
-a
+@ARGS
+--test-repo complicated1.repo
+add a
+@EXPECT
+(1/4) Installing d (1.5)
+(2/4) Installing c (1)
+(3/4) Installing b (1)
+(4/4) Installing a (2)
+OK: 0 MiB in 0 packages
diff --git a/test/complicated2.expect b/test/complicated2.expect
deleted file mode 100644
index 5261d10def..0000000000
--- a/test/complicated2.expect
+++ /dev/null
@@ -1,3 +0,0 @@
-Installing d (1.5)
-Installing c (1)
-Installing b (1)
diff --git a/test/complicated2.test b/test/complicated2.test
index e2d0ef3a4c..bdcf9e529d 100644
--- a/test/complicated2.test
+++ b/test/complicated2.test
@@ -1,2 +1,8 @@
---raw-repository complicated1.repo
-b
+@ARGS
+--test-repo complicated1.repo
+add b
+@EXPECT
+(1/3) Installing d (1.5)
+(2/3) Installing c (1)
+(3/3) Installing b (1)
+OK: 0 MiB in 0 packages
diff --git a/test/complicated3.expect b/test/complicated3.expect
deleted file mode 100644
index e9b2733ce5..0000000000
--- a/test/complicated3.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Installing d (2.0)
-Installing c (1)
diff --git a/test/complicated3.test b/test/complicated3.test
index 2ddba5b2c2..40bd7ea8b3 100644
--- a/test/complicated3.test
+++ b/test/complicated3.test
@@ -1,2 +1,7 @@
---raw-repository complicated1.repo
-c
+@ARGS
+--test-repo complicated1.repo
+add c
+@EXPECT
+(1/2) Installing d (2.0)
+(2/2) Installing c (1)
+OK: 0 MiB in 0 packages
diff --git a/test/complicated4.expect b/test/complicated4.expect
deleted file mode 100644
index 44964e3e60..0000000000
--- a/test/complicated4.expect
+++ /dev/null
@@ -1,4 +0,0 @@
-Upgrading d (1.0 -> 1.5)
-Installing c (1)
-Installing b (1)
-Installing a (2)
diff --git a/test/complicated4.test b/test/complicated4.test
index dafeaad171..96e9e4a204 100644
--- a/test/complicated4.test
+++ b/test/complicated4.test
@@ -1,2 +1,11 @@
---raw-repository complicated1.repo --installed complicated1.installed
-a
+@ARGS
+--test-repo complicated1.repo
+--test-instdb complicated1.installed
+--test-world d
+add a
+@EXPECT
+(1/4) Upgrading d (1.0 -> 1.5)
+(2/4) Installing c (1)
+(3/4) Installing b (1)
+(4/4) Installing a (2)
+OK: 0 MiB in 1 packages
diff --git a/test/conflict.repo b/test/conflict.repo
index a95658caf5..b49c115602 100644
--- a/test/conflict.repo
+++ b/test/conflict.repo
@@ -3,7 +3,7 @@ P:a
V:1
S:1
I:1
-D:!b<2
+D:!b>1
C:Q1C4uoV7SdMdDhYg4OCVmI71D8HIA=
P:b
diff --git a/test/conflict1.expect b/test/conflict1.expect
deleted file mode 100644
index 03c6d67014..0000000000
--- a/test/conflict1.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Installing b (2)
-Installing a (1)
diff --git a/test/conflict1.test b/test/conflict1.test
new file mode 100644
index 0000000000..c6403e3cb6
--- /dev/null
+++ b/test/conflict1.test
@@ -0,0 +1,7 @@
+@ARGS
+--test-repo conflict.repo
+add a b
+@EXPECT
+(1/2) Installing b (1)
+(2/2) Installing a (1)
+OK: 0 MiB in 0 packages
diff --git a/test/conflict2.expect b/test/conflict2.expect
deleted file mode 100644
index 250f942769..0000000000
--- a/test/conflict2.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-1 unsatisfiable dependencies (solution with 2 names)
-world: b<2
diff --git a/test/conflict2.test b/test/conflict2.test
new file mode 100644
index 0000000000..8235e9cbdb
--- /dev/null
+++ b/test/conflict2.test
@@ -0,0 +1,6 @@
+@ARGS
+--test-repo conflict.repo
+add a b>1
+@EXPECT
+ERROR: 1 unsatisfiable dependencies:
+ a-1: !b>1
diff --git a/test/error1.expect b/test/error1.expect
deleted file mode 100644
index ddd4f4feaf..0000000000
--- a/test/error1.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-1 unsatisfiable dependencies (solution with 4 names)
-b-1: d<2.0
diff --git a/test/error1.test b/test/error1.test
index 7925b246a8..3a165f5e07 100644
--- a/test/error1.test
+++ b/test/error1.test
@@ -1,2 +1,6 @@
---raw-repository complicated1.repo
-a d>1.5
+@ARGS
+--test-repo complicated1.repo
+add a d>1.5
+@EXPECT
+ERROR: 1 unsatisfiable dependencies:
+ b-1: d<2.0
diff --git a/test/error2.expect b/test/error2.expect
deleted file mode 100644
index 7faac5e968..0000000000
--- a/test/error2.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-1 unsatisfiable dependencies (solution with 4 names)
-world: d<1.5
diff --git a/test/error2.test b/test/error2.test
index c0b344aa4a..506bcf2cd1 100644
--- a/test/error2.test
+++ b/test/error2.test
@@ -1,2 +1,6 @@
---raw-repository complicated1.repo
-a d<1.5
+@ARGS
+--test-repo complicated1.repo
+add a d<1.5
+@EXPECT
+ERROR: 1 unsatisfiable dependencies:
+ world: d<1.5
diff --git a/test/error3.expect b/test/error3.expect
deleted file mode 100644
index d04f76e8c3..0000000000
--- a/test/error3.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-1 unsatisfiable dependencies (solution with 3 names)
-a-3: b
diff --git a/test/error3.test b/test/error3.test
index 0d5f97a00c..74a817602d 100644
--- a/test/error3.test
+++ b/test/error3.test
@@ -1,2 +1,6 @@
---raw-repository complicated1.repo
-a !b
+@ARGS
+--test-repo complicated1.repo
+add a !b
+@EXPECT
+ERROR: 1 unsatisfiable dependencies:
+ a-3: b
diff --git a/test/error4.expect b/test/error4.expect
deleted file mode 100644
index a422aaa783..0000000000
--- a/test/error4.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-1 unsatisfiable dependencies (solution with 4 names)
-world: nonexistant
diff --git a/test/error4.test b/test/error4.test
index b26d13f065..c05aa93d47 100644
--- a/test/error4.test
+++ b/test/error4.test
@@ -1,2 +1,6 @@
---raw-repository complicated1.repo
-a nonexistant
+@ARGS
+--test-repo complicated1.repo
+add a nonexistant
+@EXPECT
+ERROR: 1 unsatisfiable dependencies:
+ world: nonexistant
diff --git a/test/error5.expect b/test/error5.expect
deleted file mode 100644
index ddd4f4feaf..0000000000
--- a/test/error5.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-1 unsatisfiable dependencies (solution with 4 names)
-b-1: d<2.0
diff --git a/test/error5.test b/test/error5.test
index 6c9371ee74..3086b20627 100644
--- a/test/error5.test
+++ b/test/error5.test
@@ -1,2 +1,6 @@
---raw-repository complicated1.repo
-a>2
+@ARGS
+--test-repo complicated1.repo
+add a>2
+@EXPECT
+ERROR: 1 unsatisfiable dependencies:
+ b-1: d<2.0
diff --git a/test/installif1.expect b/test/installif1.expect
deleted file mode 100644
index d9ee0583fc..0000000000
--- a/test/installif1.expect
+++ /dev/null
@@ -1,4 +0,0 @@
-Installing foo (1)
-Installing lib (1)
-Installing app (1)
-Installing appiif1 (1)
diff --git a/test/installif1.test b/test/installif1.test
index 99e139ac0a..ca3aeeb013 100644
--- a/test/installif1.test
+++ b/test/installif1.test
@@ -1,2 +1,9 @@
---raw-repository installif1.repo
-foo app
+@ARGS
+--test-repo installif1.repo
+add foo app
+@EXPECT
+(1/4) Installing foo (1)
+(2/4) Installing lib (1)
+(3/4) Installing app (1)
+(4/4) Installing appiif1 (1)
+OK: 0 MiB in 0 packages
diff --git a/test/installif2.expect b/test/installif2.expect
deleted file mode 100644
index 0cd5d31461..0000000000
--- a/test/installif2.expect
+++ /dev/null
@@ -1,6 +0,0 @@
-Installing foo (1)
-Installing lib (1)
-Installing app (1)
-Installing appiif1 (1)
-Installing bar (1)
-Installing appiif2 (1)
diff --git a/test/installif2.test b/test/installif2.test
index f4f68f592b..85f66dc9ac 100644
--- a/test/installif2.test
+++ b/test/installif2.test
@@ -1,2 +1,11 @@
---raw-repository installif1.repo
-foo app bar
+@ARGS
+--test-repo installif1.repo
+add foo app bar
+@EXPECT
+(1/6) Installing foo (1)
+(2/6) Installing lib (1)
+(3/6) Installing app (1)
+(4/6) Installing appiif1 (1)
+(5/6) Installing bar (1)
+(6/6) Installing appiif2 (1)
+OK: 0 MiB in 0 packages
diff --git a/test/installif3.expect b/test/installif3.expect
deleted file mode 100644
index d9ee0583fc..0000000000
--- a/test/installif3.expect
+++ /dev/null
@@ -1,4 +0,0 @@
-Installing foo (1)
-Installing lib (1)
-Installing app (1)
-Installing appiif1 (1)
diff --git a/test/installif3.test b/test/installif3.test
index 881b664296..f5ac259f3f 100644
--- a/test/installif3.test
+++ b/test/installif3.test
@@ -1,2 +1,10 @@
---raw-repository installif1.repo --raw-repository installif2.repo
-foo app
+@ARGS
+--test-repo installif1.repo
+--test-repo installif2.repo
+add foo app
+@EXPECT
+(1/4) Installing foo (1)
+(2/4) Installing lib (1)
+(3/4) Installing app (1)
+(4/4) Installing appiif1 (1)
+OK: 0 MiB in 0 packages
diff --git a/test/pinning1.expect b/test/pinning1.expect
deleted file mode 100644
index 81756fee50..0000000000
--- a/test/pinning1.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Installing b (2)
-Installing a (2)
diff --git a/test/pinning1.test b/test/pinning1.test
index 439687522d..311fa3fe4f 100644
--- a/test/pinning1.test
+++ b/test/pinning1.test
@@ -1,2 +1,8 @@
---raw-repository basic.repo --raw-repository +pinning.repo
-a
+@ARGS
+--test-repo basic.repo
+--test-repo +pinning.repo
+add a
+@EXPECT
+(1/2) Installing b (2)
+(2/2) Installing a (2)
+OK: 0 MiB in 0 packages
diff --git a/test/pinning2.expect b/test/pinning2.expect
deleted file mode 100644
index cce6084325..0000000000
--- a/test/pinning2.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Installing b (2)
-Installing a (3)
diff --git a/test/pinning2.test b/test/pinning2.test
index 69d4f79ddd..c65514388a 100644
--- a/test/pinning2.test
+++ b/test/pinning2.test
@@ -1,2 +1,8 @@
---raw-repository basic.repo --raw-repository +pinning.repo
-a@testing
+@ARGS
+--test-repo basic.repo
+--test-repo +pinning.repo
+add a@testing
+@EXPECT
+(1/2) Installing b (2)
+(2/2) Installing a@testing (3)
+OK: 0 MiB in 0 packages
diff --git a/test/pinning3.expect b/test/pinning3.expect
deleted file mode 100644
index a2b2fcae0d..0000000000
--- a/test/pinning3.expect
+++ /dev/null
@@ -1,2 +0,0 @@
-Installing b (3)
-Installing a (3)
diff --git a/test/pinning3.test b/test/pinning3.test
index 220f1288fe..60e073f3df 100644
--- a/test/pinning3.test
+++ b/test/pinning3.test
@@ -1,2 +1,8 @@
---raw-repository basic.repo --raw-repository +pinning.repo
-a@testing b@testing
+@ARGS
+--test-repo basic.repo
+--test-repo +pinning.repo
+add a@testing b@testing
+@EXPECT
+(1/2) Installing b@testing (3)
+(2/2) Installing a@testing (3)
+OK: 0 MiB in 0 packages
diff --git a/test/pinning4.expect b/test/pinning4.expect
deleted file mode 100644
index 5a03102bea..0000000000
--- a/test/pinning4.expect
+++ /dev/null
@@ -1,3 +0,0 @@
-Installing b (2)
-Installing a (3)
-Installing c (3)
diff --git a/test/pinning4.test b/test/pinning4.test
index 4bf8d38a83..80348f7850 100644
--- a/test/pinning4.test
+++ b/test/pinning4.test
@@ -1,2 +1,9 @@
---raw-repository basic.repo --raw-repository +pinning.repo
-c@testing
+@ARGS
+--test-repo basic.repo
+--test-repo +pinning.repo
+add c@testing
+@EXPECT
+(1/3) Installing b (2)
+(2/3) Installing a@testing (3)
+(3/3) Installing c@testing (3)
+OK: 0 MiB in 0 packages
diff --git a/test/solver.sh b/test/solver.sh
index 20dc23202e..aa9ffc5708 100755
--- a/test/solver.sh
+++ b/test/solver.sh
@@ -1,26 +1,26 @@
#!/bin/sh
-APK_TEST=../src/apk_test
+APK_TEST=../src/apk-test
fail=0
+pass=0
for test in *.test; do
- bn=$(basename $test .test)
- (
- read options
- read world
- $APK_TEST $options "$world" &> $bn.got
- ) < $bn.test
- if ! cmp $bn.expect $bn.got &> /dev/null; then
+ awk '/^@ARGS/{p=1;next} /^@/{p=0} p{print}' < $test | xargs $APK_TEST &> .$test.got
+
+ if ! awk '/^@EXPECT/{p=1;next} /^@/{p=0} p{print}' < $test | cmp .$test.got &> /dev/null; then
fail=$((fail+1))
echo "FAIL: $test"
- diff -ru $bn.expect $bn.got
+ awk '/^@EXPECT/{p=1;next} /^@/{p=0} p{print}' < $test | diff -ru - .$test.got
else
- echo "OK: $test"
+ pass=$((pass+1))
fi
done
+total=$((fail+pass))
if [ "$fail" != "0" ]; then
- echo "FAIL: $fail failed test cases"
+ echo "FAIL: $fail of $total test cases failed"
+else
+ echo "OK: all $total solver test cases passed"
fi
exit $fail