aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-03-04 14:22:28 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-03-04 14:22:28 +0000
commit02a6cdfe59cac0843085a430052613c27d07e72a (patch)
treee9c7f9b859d3676efeeeb88eda723fa9b1ccd09f
parent3827d94da125f5a1e882ca70ccbac75e0caa5cae (diff)
downloadpaludis-02a6cdfe59cac0843085a430052613c27d07e72a.tar.gz
paludis-02a6cdfe59cac0843085a430052613c27d07e72a.tar.xz
More tests
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc9
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh23
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc88
-rwxr-xr-xpaludis/repositories/e/vdb_repository_TEST_setup.sh31
4 files changed, 151 insertions, 0 deletions
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 1636189..53e3f23 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -1172,6 +1172,15 @@ namespace test_cases
TEST_CHECK(id);
id->perform_action(action);
}
+
+ {
+ TestMessageSuffix suffix("vars", true);
+ const tr1::shared_ptr<const PackageID> id(*env.package_database()->query(query::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/vars-0",
+ UserPackageDepSpecOptions()))), qo_require_exactly_one)->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
}
} test_e_repository_install_eapi_0;
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index 83ac9f2..dc4c315 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -705,6 +705,29 @@ DONE
[[ "$BV2" == "" ]] || die "BV2 is $BV2"
}
END
+mkdir -p "cat/vars"
+cat <<'END' > cat/vars/vars-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+
+src_compile() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+
+pkg_preinst() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+END
cd ..
mkdir -p repo14/{profiles/profile,metadata,eclass} || exit 1
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index d556374..191d473 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -19,6 +19,8 @@
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/e/e_repository.hh>
+#include <paludis/repositories/e/make_ebuild_repository.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
@@ -28,6 +30,7 @@
#include <paludis/query.hh>
#include <paludis/dep_spec.hh>
#include <paludis/stringify_formatter.hh>
+#include <paludis/action.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <fstream>
@@ -395,5 +398,90 @@ namespace test_cases
TEST_CHECK_STRINGIFY_EQUAL(pp, "build: build,run: suggested: post: cat/pkg5");
}
} test_vdb_repository_dependencies_rewriter;
+
+ struct InstallReinstallUninstallTest : TestCase
+ {
+ InstallReinstallUninstallTest() : TestCase("install / reinstall / uninstall") { }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+ TestEnvironment env;
+ tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", "vdb_repository_TEST_dir/srcrepo");
+ keys->insert("profiles", "vdb_repository_TEST_dir/srcrepo/profiles/profile");
+ keys->insert("layout", "traditional");
+ keys->insert("eapi_when_unknown", "0");
+ keys->insert("eapi_when_unspecified", "0");
+ keys->insert("profile_eapi", "0");
+ keys->insert("distdir", stringify(FSEntry::cwd() / "vdb_repository_TEST_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSEntry::cwd() / "vdb_repository_TEST_dir" / "build"));
+ keys->insert("root", "vdb_repository_TEST_dir/root");
+ tr1::shared_ptr<ERepository> repo(make_ebuild_repository(&env, keys));
+ env.package_database()->add_repository(1, repo);
+
+ keys.reset(new Map<std::string, std::string>);
+ keys->insert("format", "vdb");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("provides_cache", "/var/empty");
+ keys->insert("location", "vdb_repository_TEST_dir/repo3");
+ keys->insert("root", "vdb_repository_TEST_dir/root");
+ tr1::shared_ptr<Repository> vdb_repo(VDBRepository::make_vdb_repository(&env, keys));
+ env.package_database()->add_repository(0, vdb_repo);
+
+ InstallAction install_action(InstallActionOptions::named_create()
+ (k::debug_build(), iado_none)
+ (k::checks(), iaco_default)
+ (k::no_config_protect(), false)
+ (k::destination(), vdb_repo)
+ );
+
+ UninstallAction uninstall_action(UninstallActionOptions::named_create()
+ (k::no_config_protect(), false)
+ );
+
+ {
+ TestMessageSuffix suffix("install", true);
+ const tr1::shared_ptr<const PackageID> id(*env.package_database()->query(query::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/target-1::srcrepo",
+ UserPackageDepSpecOptions()))), qo_require_exactly_one)->last());
+ TEST_CHECK(id);
+ id->perform_action(install_action);
+ }
+
+ vdb_repo->invalidate();
+
+ {
+ TestMessageSuffix suffix("reinstall", true);
+ const tr1::shared_ptr<const PackageID> id(*env.package_database()->query(query::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/target-1::srcrepo",
+ UserPackageDepSpecOptions()))), qo_require_exactly_one)->last());
+ TEST_CHECK(id);
+ id->perform_action(install_action);
+ }
+
+ vdb_repo->invalidate();
+
+ {
+ TestMessageSuffix suffix("uninstall", true);
+ const tr1::shared_ptr<const PackageID> id(*env.package_database()->query(query::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/target-1::installed",
+ UserPackageDepSpecOptions()))), qo_require_exactly_one)->last());
+ TEST_CHECK(id);
+ id->perform_action(uninstall_action);
+ }
+ }
+ } test_vdb_install_reinstall_uninstall;
}
diff --git a/paludis/repositories/e/vdb_repository_TEST_setup.sh b/paludis/repositories/e/vdb_repository_TEST_setup.sh
index 0991c5e..ca97910 100755
--- a/paludis/repositories/e/vdb_repository_TEST_setup.sh
+++ b/paludis/repositories/e/vdb_repository_TEST_setup.sh
@@ -4,6 +4,10 @@
mkdir -p vdb_repository_TEST_dir || exit 1
cd vdb_repository_TEST_dir || exit 1
+mkdir -p distdir
+mkdir -p build
+mkdir -p root/etc
+
mkdir -p repo1/cat-{one/{pkg-one-1,pkg-both-1},two/{pkg-two-2,pkg-both-2}} || exit 1
for i in SLOT EAPI; do
@@ -76,3 +80,30 @@ echo "exheres-0" >repo2/category/package-1/EAPI
echo "0" >repo2/category/package-1/SLOT
echo "cat/pkg1 build: cat/pkg2 build,run: cat/pkg3 suggested: cat/pkg4 post: cat/pkg5" >repo2/category/package-1/DEPENDENCIES
+mkdir -p repo3
+
+mkdir -p srcrepo/{profiles/profile,cat/target,eclass}
+cat <<END > srcrepo/profiles/profile/make.defaults
+ARCH=test
+USERLAND="GNU"
+KERNEL="linux"
+CHOST="i286-badger-linux-gnu"
+PALUDIS_COMMAND="/bin/false"
+END
+echo "srcrepo" > srcrepo/profiles/repo_name || exit 1
+
+cat <<'END' > srcrepo/cat/target/target-1.ebuild
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+DEPEND="foo/bar"
+
+src_install() {
+ echo MONKEY > ${D}/monkey
+}
+END
+