summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
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 81756fe..0000000
--- 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 b3a4bb7..b906cc4 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 e69de29..0000000
--- a/test/basic2.expect
+++ /dev/null
diff --git a/test/basic2.test b/test/basic2.test
index 75b172c..e89d0dd 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 73bef16..0000000
--- 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 0a790a4..9efee6b 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 9dacff1..0000000
--- a/test/basic4.expect
+++ /dev/null
@@ -1 +0,0 @@
-Purging a (1)
diff --git a/test/basic4.test b/test/basic4.test
index b12d9cf..906c1e9 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 b29db17..0000000
--- 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 40bf72a..854f5e7 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 e69de29..0000000
--- a/test/basic6.expect
+++ /dev/null
diff --git a/test/basic6.test b/test/basic6.test
index d9fbe64..6914767 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 e69de29..0000000
--- a/test/basic7.expect
+++ /dev/null
diff --git a/test/basic7.test b/test/basic7.test
index c53d2d2..a1f153a 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 1387f53..0000000
--- 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 070f2e1..53ea08a 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 5261d10..0000000
--- 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 e2d0ef3..bdcf9e5 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 e9b2733..0000000
--- 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 2ddba5b..40bd7ea 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 44964e3..0000000
--- 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 dafeaad..96e9e4a 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 a95658c..b49c115 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 03c6d67..0000000
--- 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 0000000..c6403e3
--- /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 250f942..0000000
--- 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 0000000..8235e9c
--- /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 ddd4f4f..0000000
--- 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 7925b24..3a165f5 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 7faac5e..0000000
--- 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 c0b344a..506bcf2 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 d04f76e..0000000
--- 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 0d5f97a..74a8176 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 a422aaa..0000000
--- 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 b26d13f..c05aa93 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 ddd4f4f..0000000
--- 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 6c9371e..3086b20 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 d9ee058..0000000
--- 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 99e139a..ca3aeeb 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 0cd5d31..0000000
--- 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 f4f68f5..85f66dc 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 d9ee058..0000000
--- 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 881b664..f5ac259 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 81756fe..0000000
--- 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 4396875..311fa3f 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 cce6084..0000000
--- 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 69d4f79..c655143 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 a2b2fca..0000000
--- 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 220f128..60e073f 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 5a03102..0000000
--- 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 4bf8d38..80348f7 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 20dc232..aa9ffc5 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