aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-08 16:53:55 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-08 16:53:55 +0000
commitf6cd0a0962416d3bab088d0448f8f86da1788729 (patch)
tree5e2fbf268452e98693490fbdf8c3b4636c85b556
parentfc06c987699d025b6828bc07b9ece67d4c610e5e (diff)
downloadpaludis-f6cd0a0962416d3bab088d0448f8f86da1788729.tar.gz
paludis-f6cd0a0962416d3bab088d0448f8f86da1788729.tar.xz
Move test scripts out of the Makefile. Add a test for installing then upgrading a package.
-rw-r--r--src/Makefile.am34
-rwxr-xr-xsrc/exception_TEST6
-rwxr-xr-xsrc/help_TEST3
-rwxr-xr-xsrc/install_TEST5
-rwxr-xr-xsrc/list_dep_tag_categories_TEST3
-rwxr-xr-xsrc/list_repository_formats_TEST3
-rwxr-xr-xsrc/list_sync_formats_TEST3
-rwxr-xr-xsrc/upgrade_TEST17
-rwxr-xr-xsrc/upgrade_TEST_cleanup.sh11
-rwxr-xr-xsrc/upgrade_TEST_setup.sh125
-rwxr-xr-xsrc/version_TEST3
11 files changed, 184 insertions, 29 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 2eabf8d..16b2c78 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,36 +35,12 @@ TESTS_ENVIRONMENT = env \
TESTS = version_TEST help_TEST list_sync_formats_TEST \
list_repository_formats_TEST list_dep_tag_categories_TEST \
- exception_TEST install_TEST
+ exception_TEST install_TEST upgrade_TEST
-EXTRA_DIST = install_TEST_setup.sh install_TEST_cleanup.sh
+EXTRA_DIST = $(TESTS) \
+ install_TEST_setup.sh install_TEST_cleanup.sh \
+ upgrade_TEST_setup.sh upgrade_TEST_cleanup.sh
-CLEANFILES = *~ $(TESTS) gmon.out *.gcov *.gcno *.gcda
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
MAINTAINERCLEANFILES = Makefile.in
-version_TEST : paludis
- echo -e "#!/bin/sh\nenv PALUDIS_SKIP_CONFIG=yes ./paludis --version" > $@
-
-help_TEST : paludis
- echo -e "#!/bin/sh\nenv PALUDIS_SKIP_CONFIG=yes ./paludis --help" > $@
-
-exception_TEST : paludis
- echo -e "#!/bin/sh\nenv PALUDIS_HOME=./ \\" > $@
- echo -e " ./paludis --config-suffix paludis-build-test -pi asdf 2>&1 \\" >> $@
- echo -e " | grep 'Default configuration error' >/dev/null" >> $@
-
-list_sync_formats_TEST : paludis
- echo -e "#!/bin/sh\nenv PALUDIS_SKIP_CONFIG=yes ./paludis --list-sync-protocols" > $@
-
-list_repository_formats_TEST : paludis
- echo -e "#!/bin/sh\nenv PALUDIS_SKIP_CONFIG=yes ./paludis --list-repository-formats" > $@
-
-list_dep_tag_categories_TEST : paludis
- echo -e "#!/bin/sh\nenv PALUDIS_SKIP_CONFIG=yes ./paludis --list-dep-tag-categories" > $@
-
-install_TEST : paludis
- echo -e "#!/bin/sh\nenv \\" > $@
- echo -e " PALUDIS_HOME=./install_TEST_dir/config/ \\" >> $@
- echo -e " ./paludis --config-suffix install-test --install target" >> $@
- echo -e "./install_TEST_dir/root/usr/bin/testbin | grep success >/dev/null" >> $@
-
diff --git a/src/exception_TEST b/src/exception_TEST
new file mode 100755
index 0000000..a3daaaf
--- /dev/null
+++ b/src/exception_TEST
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+PALUDIS_HOME=./ \
+ ./paludis --config-suffix paludis-build-test -pi asdf 2>&1 \
+ | grep 'Default configuration error' >/dev/null
+
diff --git a/src/help_TEST b/src/help_TEST
new file mode 100755
index 0000000..3a0f5fb
--- /dev/null
+++ b/src/help_TEST
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PALUDIS_SKIP_CONFIG=yes ./paludis --help
diff --git a/src/install_TEST b/src/install_TEST
new file mode 100755
index 0000000..eab20a9
--- /dev/null
+++ b/src/install_TEST
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --config-suffix install-test --install target || exit 1
+./install_TEST_dir/root/usr/bin/testbin | grep success >/dev/null
+
diff --git a/src/list_dep_tag_categories_TEST b/src/list_dep_tag_categories_TEST
new file mode 100755
index 0000000..40fa15c
--- /dev/null
+++ b/src/list_dep_tag_categories_TEST
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PALUDIS_SKIP_CONFIG=yes ./paludis --list-dep-tag-categories
diff --git a/src/list_repository_formats_TEST b/src/list_repository_formats_TEST
new file mode 100755
index 0000000..487513c
--- /dev/null
+++ b/src/list_repository_formats_TEST
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PALUDIS_SKIP_CONFIG=yes ./paludis --list-repository-formats
diff --git a/src/list_sync_formats_TEST b/src/list_sync_formats_TEST
new file mode 100755
index 0000000..f638b22
--- /dev/null
+++ b/src/list_sync_formats_TEST
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PALUDIS_SKIP_CONFIG=yes ./paludis --list-sync-protocols
diff --git a/src/upgrade_TEST b/src/upgrade_TEST
new file mode 100755
index 0000000..48b315f
--- /dev/null
+++ b/src/upgrade_TEST
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+PALUDIS_HOME=./upgrade_TEST_dir/config/ \
+ ./paludis --config-suffix upgrade-test --install =test-category/target-1 || exit 1
+
+./upgrade_TEST_dir/root/usr/bin/testbin | grep testbin-1 >/dev/null || exit 1
+./upgrade_TEST_dir/root/usr/bin/testbin1 | grep testbin1 >/dev/null || exit 1
+./upgrade_TEST_dir/root/usr/bin/testbin2 && exit 1
+
+
+PALUDIS_HOME=./upgrade_TEST_dir/config/ \
+ ./paludis --config-suffix upgrade-test --install target || exit 1
+
+./upgrade_TEST_dir/root/usr/bin/testbin | grep testbin-2 >/dev/null || exit 1
+./upgrade_TEST_dir/root/usr/bin/testbin1 && exit 1
+./upgrade_TEST_dir/root/usr/bin/testbin2 | grep testbin2 >/dev/null || exit 1
+
diff --git a/src/upgrade_TEST_cleanup.sh b/src/upgrade_TEST_cleanup.sh
new file mode 100755
index 0000000..bc42e78
--- /dev/null
+++ b/src/upgrade_TEST_cleanup.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d upgrade_TEST_dir ] ; then
+ rm -fr upgrade_TEST_dir
+else
+ true
+fi
+
+
+
diff --git a/src/upgrade_TEST_setup.sh b/src/upgrade_TEST_setup.sh
new file mode 100755
index 0000000..efc72e2
--- /dev/null
+++ b/src/upgrade_TEST_setup.sh
@@ -0,0 +1,125 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir upgrade_TEST_dir || exit 1
+cd upgrade_TEST_dir || exit 1
+
+mkdir -p config/.paludis-upgrade-test
+cat <<END > config/.paludis-upgrade-test/specpath
+root = `pwd`/root
+config-suffix =
+END
+
+mkdir -p root/${SYSCONFDIR}/paludis/repositories
+cat <<END > root/${SYSCONFDIR}/paludis/use.conf
+* foo
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/licenses.conf
+* *
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/keywords.conf
+* test
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/bashrc
+export CHOST="my-chost"
+export USER_BASHRC_WAS_USED=yes
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/repositories/repo1.conf
+location = `pwd`/repo1
+cache = /var/empty
+format = portage
+profile = \${location}/profiles/testprofile
+buildroot = `pwd`/build
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/repositories/installed.conf
+location = \${ROOT}/var/db/pkg
+format = vdb
+END
+
+mkdir -p root/tmp
+touch root/${SYSCONFDIR}/ld.so.conf
+mkdir -p root/var/db/pkg
+
+mkdir -p repo1/{eclass,distfiles,profiles/testprofile,test-category/target/files} || exit 1
+
+mkdir -p src/target-1
+cat <<"END" > src/target-1/testbin
+#!/bin/bash
+echo "This is testbin-1"
+END
+chmod +x src/target-1/testbin
+cat <<"END" > src/target-1/testbin1
+#!/bin/bash
+echo "This is testbin1"
+END
+chmod +x src/target-1/testbin1
+cd src
+tar zcf target-1.tar.gz target-1/
+mv target-1.tar.gz ../repo1/distfiles/
+cd ..
+rm -fr src
+
+mkdir -p src/target-2
+cat <<"END" > src/target-2/testbin
+#!/bin/bash
+echo "This is testbin-2"
+END
+chmod +x src/target-2/testbin
+cat <<"END" > src/target-2/testbin2
+#!/bin/bash
+echo "This is testbin2"
+END
+chmod +x src/target-2/testbin2
+cd src
+tar zcf target-2.tar.gz target-2/
+mv target-2.tar.gz ../repo1/distfiles/
+cd ..
+rm -fr src
+
+cd repo1 || exit 1
+echo "test-repo-1" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+test-category
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+END
+
+cat <<"END" > test-category/target/target-1.ebuild || exit 1
+DESCRIPTION="Test target"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI="http://invalid.domain/${P}.tar.gz"
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin testbin
+ dobin testbin${PV}
+}
+END
+
+cat <<"END" > test-category/target/target-2.ebuild || exit 1
+DESCRIPTION="Test target"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI="http://invalid.domain/${P}.tar.gz"
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin testbin
+ dobin testbin${PV}
+}
+END
+cd ..
+
diff --git a/src/version_TEST b/src/version_TEST
new file mode 100755
index 0000000..02513f0
--- /dev/null
+++ b/src/version_TEST
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+PALUDIS_SKIP_CONFIG=yes ./paludis --version