aboutsummaryrefslogtreecommitdiff
path: root/t/test_pbuilder-apt-config
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-10-13 10:26:06 +0000
committerMattia Rizzolo <mattia@mapreri.org>2015-10-13 10:26:06 +0000
commit72075b8430b826d7dd489765c1004e4161479fa2 (patch)
tree682a8d69bcc478082f1805859eb72445e8b6cf42 /t/test_pbuilder-apt-config
parent524cde2e544f40dc2056d2a4c4265ddc4160784d (diff)
downloadpbuilder-72075b8430b826d7dd489765c1004e4161479fa2.tar
pbuilder-72075b8430b826d7dd489765c1004e4161479fa2.tar.gz
move all tests under a t/ directory
Diffstat (limited to 't/test_pbuilder-apt-config')
-rwxr-xr-xt/test_pbuilder-apt-config183
1 files changed, 183 insertions, 0 deletions
diff --git a/t/test_pbuilder-apt-config b/t/test_pbuilder-apt-config
new file mode 100755
index 0000000..e00730e
--- /dev/null
+++ b/t/test_pbuilder-apt-config
@@ -0,0 +1,183 @@
+#!/bin/bash
+
+set -e
+
+self="$(basename "$0")"
+
+TD="$(dirname "$0")"
+if [ -n "$PBUILDER_CHECKOUT" ]; then
+ . "$TD/testlib.sh"
+ PBUILDER_APT_CONFIG="$PBUILDER_CHECKOUT/pbuilder-apt-config"
+else
+ . "$TD/testlib.sh"
+ PBUILDER_APT_CONFIG="$PBUILDER_TEST_PKGLIBDIR/pbuilder-apt-config"
+fi
+
+mirror_map=""
+
+cleanup() {
+ if [ -n "$mirror_map" ]; then
+ rm -f "$mirror_map"
+ fi
+}
+
+mirror_map="$(mktemp -t "$self.XXXXXXXXXX")"
+cat >"$mirror_map" <<EOF
+archive archive-mirror
+ubuntu ubuntu-mirror
+ubuntu-ports ubuntu-ports-mirror
+ubuntu-security ubuntu-security-mirror
+nomirror
+
+ppa:people ppa-people-ppa
+ppa:people/otherppa ppa-people-otherppa
+
+# no mirror
+debian-archive
+EOF
+
+run_suite_mode() {
+ "$PBUILDER_APT_CONFIG" --mirror-map="$mirror_map" --with-sources=no --mirror mirror --suite hamm --components component apt-sources "$@"
+}
+
+debootstrap_suite() {
+ "$PBUILDER_APT_CONFIG" --mirror-map="$mirror_map" --with-sources=no --mirror mirror --components component debootstrap-suite "$@"
+}
+
+debootstrap_mirror() {
+ "$PBUILDER_APT_CONFIG" --mirror-map="$mirror_map" --with-sources=no --components component debootstrap-mirror "$@"
+}
+
+test_components() {
+ run_suite_mode --components comp1
+ run_suite_mode --components comp1,comp2,comp3
+ run_suite_mode --components "comp1 comp2 comp3"
+}
+
+test_pockets() {
+ run_suite_mode --pockets ""
+ echo
+ run_suite_mode --pockets pocket1
+ echo
+ run_suite_mode --pockets pocket1,pocket2,pocket3
+ echo
+ run_suite_mode --pockets "pocket1 pocket2 pocket3"
+}
+
+strip_mirror() {
+ local deb mirror eol
+
+ while read deb mirror eol; do
+ echo "$deb $eol"
+ done
+}
+
+test_profile() {
+ local profile="$1"
+ "$PBUILDER_APT_CONFIG" --with-sources=no --profile "$profile" --components comp1 apt-sources | strip_mirror
+}
+
+test_fail() {
+ exit 1
+}
+
+test_options() {
+ echo "$@"
+ exit 1
+}
+
+expect_output "deb mirror hamm component" run_suite_mode --suite hamm
+
+expect_output "deb archive-mirror hamm component" run_suite_mode --mirror "" --archive archive
+expect_fail run_suite_mode --mirror "" --archive nomirror
+expect_output "deb http://archive.debian.org/debian/ bo component" run_suite_mode --mirror "" --suite bo
+
+expect_output "deb ubuntu-mirror lucid component" run_suite_mode --mirror "" --suite lucid --arch i386
+expect_output "deb ubuntu-ports-mirror lucid component" run_suite_mode --mirror "" --suite lucid --arch armel
+
+expect_output "deb mirror hamm comp1
+deb mirror hamm comp1 comp2 comp3
+deb mirror hamm comp1 comp2 comp3" test_components
+
+expect_output "deb mirror hamm component
+
+deb mirror hamm component
+deb mirror hamm-pocket1 component
+
+deb mirror hamm component
+deb mirror hamm-pocket1 component
+deb mirror hamm-pocket2 component
+deb mirror hamm-pocket3 component
+
+deb mirror hamm component
+deb mirror hamm-pocket1 component
+deb mirror hamm-pocket2 component
+deb mirror hamm-pocket3 component" test_pockets
+
+expect_output "deb unstable comp1" test_profile unstable
+expect_output "deb sid comp1" test_profile sid
+expect_output "deb unstable comp1
+deb experimental comp1" test_profile experimental
+expect_output "deb squeeze comp1
+deb squeeze/updates comp1" test_profile squeeze/updates
+expect_output "deb squeeze comp1
+deb squeeze-proposed-updates comp1" test_profile squeeze-proposed-updates
+expect_output "deb squeeze comp1
+deb squeeze-backports comp1" test_profile squeeze-backports
+expect_output "deb squeeze comp1
+deb squeeze/volatile comp1" test_profile squeeze/volatile
+expect_output "deb squeeze comp1
+deb squeeze/volatile comp1
+deb squeeze/volatile-sloppy comp1" test_profile squeeze/volatile-sloppy
+expect_output "deb squeeze comp1
+deb squeeze/volatile comp1
+deb squeeze-proposed-updates/volatile comp1" test_profile squeeze-proposed-updates/volatile
+expect_output "deb bo comp1" test_profile bo
+
+expect_output "deb lucid comp1" test_profile lucid
+expect_output "deb lucid comp1
+deb lucid-security comp1
+deb lucid-security comp1" test_profile lucid-security
+expect_output "deb lucid comp1
+deb lucid-security comp1
+deb lucid-updates comp1
+deb lucid-security comp1" test_profile lucid-updates
+expect_output "deb lucid comp1
+deb lucid-security comp1
+deb lucid-updates comp1
+deb lucid-backports comp1
+deb lucid-security comp1" test_profile lucid-backports
+expect_output "deb lucid comp1
+deb lucid-security comp1
+deb lucid-updates comp1
+deb lucid-proposed comp1
+deb lucid-security comp1" test_profile lucid-proposed
+
+expect_output "deb mirror hamm component
+deb-src mirror hamm component" run_suite_mode --with-sources=yes
+expect_output "deb mirror hamm component
+deb-src mirror hamm component" run_suite_mode --with-sources=
+expect_output "deb mirror hamm component
+#deb-src mirror hamm component" run_suite_mode --with-sources=disabled
+expect_output "deb mirror hamm component" run_suite_mode --with-sources=no
+
+expect_output "deb ubuntu-mirror hamm component" run_suite_mode --mirror "" --archive ubuntu
+expect_output "deb ubuntu-ports-mirror hamm component" run_suite_mode --arch armel --mirror "" --archive ubuntu-ports
+expect_fail run_hamm_mode --arch armel --mirror "" --archive otherarchive
+expect_success run_suite_mode --mirror "" --suite lucid
+expect_fail run_suite_mode --mirror "" --suite suite
+expect_success run_suite_mode --mirror "" --suite suite --archive ubuntu
+expect_output "deb ppa-people-ppa suite component" run_suite_mode --mirror "" --suite suite --archive ppa:people
+expect_output "deb ppa-people-otherppa suite component" run_suite_mode --mirror "" --suite suite --archive ppa:people/otherppa
+
+expect_output "hamm" debootstrap_suite --suite hamm
+expect_output "sid" debootstrap_suite --suite sid
+expect_output "sid" debootstrap_suite --suite unstable
+expect_output "mirror" debootstrap_mirror --suite sid --mirror mirror
+
+expect_output "sid" debootstrap_suite --profile sid
+expect_output "sid" debootstrap_suite --profile unstable
+expect_output "ubuntu-mirror" debootstrap_mirror --profile lucid --arch amd64
+expect_output "ubuntu-ports-mirror" debootstrap_mirror --profile lucid --arch armel
+
+testlib_summary