summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-apt-get-source-arch4
-rwxr-xr-xtest/integration/test-apt-progress-fd-conffile43
-rwxr-xr-xtest/integration/test-bug-728500-tempdir18
-rwxr-xr-xtest/integration/test-bug-732746-preferences32
-rw-r--r--test/libapt/fileutl_test.cc13
5 files changed, 108 insertions, 2 deletions
diff --git a/test/integration/test-apt-get-source-arch b/test/integration/test-apt-get-source-arch
index 97d0e096a..d7ed56dc9 100755
--- a/test/integration/test-apt-get-source-arch
+++ b/test/integration/test-apt-get-source-arch
@@ -61,10 +61,10 @@ E: Unable to find a source package for foo:not-a-available-arch" aptget source -
# error on unavailable version for arch
testequal "$HEADER
-E: Can not find a package 'foo:amd64' with version '2.0' and release ''
+E: Can not find a package 'foo:amd64' with version '2.0'
E: Unable to find a source package for foo:amd64=2.0" aptget source -q --print-uris foo:amd64=2.0
# error on unavailable release for arch
testequal "$HEADER
-E: Can not find a package 'foo:amd64' with version '' and release 'oldstable'
+E: Can not find a package 'foo:amd64' with release 'oldstable'
E: Unable to find a source package for foo:amd64/oldstable" aptget source -q --print-uris foo:amd64/oldstable
diff --git a/test/integration/test-apt-progress-fd-conffile b/test/integration/test-apt-progress-fd-conffile
new file mode 100755
index 000000000..0b42b1b2f
--- /dev/null
+++ b/test/integration/test-apt-progress-fd-conffile
@@ -0,0 +1,43 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'native'
+
+# old conffile
+setupsimplenativepackage 'compiz-core' 'native' '1.0' 'unstable'
+BUILDDIR='incoming/compiz-core-1.0'
+mkdir -p ${BUILDDIR}/debian/compiz-core/etc
+echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
+echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
+buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
+rm -rf "$BUILDDIR"
+
+# new conffile
+setupsimplenativepackage 'compiz-core' 'native' '2.0' 'unstable'
+BUILDDIR='incoming/compiz-core-2.0'
+mkdir -p ${BUILDDIR}/debian/compiz-core/etc
+echo 'foo2=bar2;' > ${BUILDDIR}/compiz.conf
+echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
+buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
+rm -rf "$BUILDDIR"
+
+setupaptarchive
+
+testsuccess aptget install compiz-core=1.0
+
+# fake conffile change
+echo "meep" >> rootdir/etc/compiz.conf/compiz.conf
+
+# install
+exec 3> apt-progress.log
+echo n | aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false
+
+# and ensure there is a conffile message in the file
+msgtest "Conffile prompt in apt-progress.log"
+grep -q "pmconffile:/etc/compiz.conf/compiz.conf" apt-progress.log && msgpass || (cat apt-progress.log && msgfail)
+
+cat apt-progress.log \ No newline at end of file
diff --git a/test/integration/test-bug-728500-tempdir b/test/integration/test-bug-728500-tempdir
new file mode 100755
index 000000000..0606538a1
--- /dev/null
+++ b/test/integration/test-bug-728500-tempdir
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'
+
+setupaptarchive
+changetowebserver
+
+msgtest 'Test with incorect TMPDIR'
+export TMPDIR=/does-not-exists
+aptget update && msgpass || msgfail
+unset TMPDIR \ No newline at end of file
diff --git a/test/integration/test-bug-732746-preferences b/test/integration/test-bug-732746-preferences
new file mode 100755
index 000000000..b31f98aa0
--- /dev/null
+++ b/test/integration/test-bug-732746-preferences
@@ -0,0 +1,32 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertinstalledpackage 'bar' 'i386' '1.0'
+
+cat > rootdir/etc/apt/preferences << EOF
+# random test comment header
+
+# commented out by puppy^Wpuppet
+#Package: foo
+#Pin: origin "ftp.debian.org"
+#Pin: 800
+
+Package: bar
+Pin: version 1.0
+Pin-Priority: 700
+
+#Package: bar
+#Pin: version 1.0
+#Pin: 800
+EOF
+
+testequal "Reading package lists...
+Building dependency tree..." aptget check
+
+msgtest "Ensure policy is applied"
+aptcache policy bar|grep -q "*** 1.0 700" && msgpass || msgfail
diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc
index b6b8ac579..462bdefd9 100644
--- a/test/libapt/fileutl_test.cc
+++ b/test/libapt/fileutl_test.cc
@@ -38,5 +38,18 @@ int main(int argc,char *argv[])
return 1;
}
+ // GetTempDir()
+ unsetenv("TMPDIR");
+ equals(GetTempDir(), "/tmp");
+
+ setenv("TMPDIR", "", 1);
+ equals(GetTempDir(), "/tmp");
+
+ setenv("TMPDIR", "/not-there-no-really-not", 1);
+ equals(GetTempDir(), "/tmp");
+
+ setenv("TMPDIR", "/usr", 1);
+ equals(GetTempDir(), "/usr");
+
return 0;
}