aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-04-27 17:40:16 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-04-27 17:40:16 +0100
commit4ae48a93d3cff78807ee86bc13302d3ac410e2fa (patch)
tree15de1545f8a8725d5b59734030094f8e1c47ba1d
parentd41fa4a6c335c06272396b383ef84fe8009e619c (diff)
downloadpaludis-4ae48a93d3cff78807ee86bc13302d3ac410e2fa.tar.gz
paludis-4ae48a93d3cff78807ee86bc13302d3ac410e2fa.tar.xz
Add src_test_slow
-rw-r--r--.gitignore1
-rw-r--r--paludis/elike_choices-fwd.hh3
-rw-r--r--paludis/elike_choices.cc62
-rw-r--r--paludis/elike_choices.hh24
-rw-r--r--paludis/environments/test/test_environment.cc14
-rw-r--r--paludis/environments/test/test_environment.hh2
-rw-r--r--paludis/repositories/e/Makefile.am19
-rw-r--r--paludis/repositories/e/e_repository_TEST_phases.cc200
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_phases_cleanup.sh9
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_phases_setup.sh74
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/0.conf1
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf4
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf1
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/Makefile.am1
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/src_test_slow.bash58
-rw-r--r--paludis/repositories/e/ebuild_entries.cc7
-rw-r--r--paludis/repositories/e/ebuild_id.cc25
19 files changed, 503 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 52c523e..3b0d4e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -223,6 +223,7 @@ paludis-*.*.*.tar.bz2
/paludis/repositories/e/e_repository_TEST
/paludis/repositories/e/e_repository_TEST_ever
/paludis/repositories/e/e_repository_TEST_exlibs
+/paludis/repositories/e/e_repository_TEST_phases
/paludis/repositories/e/e_repository_TEST_replacing
/paludis/repositories/e/e_repository_sets_TEST
/paludis/repositories/e/ebuild_flat_metadata_cache_TEST
diff --git a/paludis/elike_choices-fwd.hh b/paludis/elike_choices-fwd.hh
index e2f06c9..644c1b1 100644
--- a/paludis/elike_choices-fwd.hh
+++ b/paludis/elike_choices-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -30,6 +30,7 @@ namespace paludis
struct ELikeSplitChoiceValue;
struct ELikeOptionalTestsChoiceValue;
struct ELikeRecommendedTestsChoiceValue;
+ struct ELikeSlowTestsChoiceValue;
const ChoicePrefixName canonical_build_options_prefix() PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
const std::string canonical_build_options_raw_name() PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc
index 7d42d33..d7251d6 100644
--- a/paludis/elike_choices.cc
+++ b/paludis/elike_choices.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -282,3 +282,63 @@ paludis::canonical_build_options_human_name()
return "Build Options";
}
+const UnprefixedChoiceName
+ELikeSlowTestsChoiceValue::canonical_unprefixed_name()
+{
+ return UnprefixedChoiceName("slow_tests");
+}
+
+const ChoiceNameWithPrefix
+ELikeSlowTestsChoiceValue::canonical_name_with_prefix()
+{
+ return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" + stringify(canonical_unprefixed_name()));
+}
+
+ELikeSlowTestsChoiceValue::ELikeSlowTestsChoiceValue(const std::tr1::shared_ptr<const PackageID> & id,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> & choice) :
+ _enabled(env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true())
+{
+}
+
+const UnprefixedChoiceName
+ELikeSlowTestsChoiceValue::unprefixed_name() const
+{
+ return canonical_unprefixed_name();
+}
+
+const ChoiceNameWithPrefix
+ELikeSlowTestsChoiceValue::name_with_prefix() const
+{
+ return canonical_name_with_prefix();
+}
+
+bool
+ELikeSlowTestsChoiceValue::enabled() const
+{
+ return _enabled;
+}
+
+bool
+ELikeSlowTestsChoiceValue::enabled_by_default() const
+{
+ return false;
+}
+
+bool
+ELikeSlowTestsChoiceValue::locked() const
+{
+ return false;
+}
+
+const std::string
+ELikeSlowTestsChoiceValue::description() const
+{
+ return "Run tests considered by the package to be useful, but slow";
+}
+
+bool
+ELikeSlowTestsChoiceValue::explicitly_listed() const
+{
+ return true;
+}
+
diff --git a/paludis/elike_choices.hh b/paludis/elike_choices.hh
index f6c78ee..ecc783e 100644
--- a/paludis/elike_choices.hh
+++ b/paludis/elike_choices.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -115,6 +115,28 @@ namespace paludis
static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ class PALUDIS_VISIBLE ELikeSlowTestsChoiceValue :
+ public ChoiceValue
+ {
+ private:
+ const bool _enabled;
+
+ public:
+ ELikeSlowTestsChoiceValue(const std::tr1::shared_ptr<const PackageID> &,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> &);
+
+ virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled_by_default() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
+ static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
}
#endif
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index 983a9dc..a26ff8d 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -34,6 +34,7 @@
#include <paludis/package_id.hh>
#include <paludis/hook.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/choice.hh>
#include <tr1/functional>
#include <tr1/unordered_map>
#include <string>
@@ -50,6 +51,7 @@ namespace paludis
{
std::tr1::shared_ptr<PackageDatabase> package_database;
std::string paludis_command;
+ std::tr1::unordered_map<std::string, Tribool> override_want_choice_enabled;
FSEntry root;
Sets sets;
@@ -246,10 +248,14 @@ TestEnvironment::config_location_key() const
const Tribool
TestEnvironment::want_choice_enabled(
const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const Choice> &,
+ const std::tr1::shared_ptr<const Choice> & c,
const UnprefixedChoiceName & v
) const
{
+ std::string s(stringify(c->prefix()) + ":" + stringify(v));
+ if (_imp->override_want_choice_enabled.end() != _imp->override_want_choice_enabled.find(s))
+ return _imp->override_want_choice_enabled.find(s)->second;
+
if (stringify(v) == "pkgname")
{
if ("enabled" == stringify(id->name().package()))
@@ -283,3 +289,9 @@ TestEnvironment::create_output_manager(const CreateOutputManagerInfo &) const
return make_shared_ptr(new StandardOutputManager);
}
+void
+TestEnvironment::set_want_choice_enabled(const ChoicePrefixName & p, const UnprefixedChoiceName & n, const Tribool v)
+{
+ _imp->override_want_choice_enabled[stringify(p) + ":" + stringify(n)] = v;
+}
+
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index 6cf563e..381344b 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -139,6 +139,8 @@ namespace paludis
virtual const std::tr1::shared_ptr<OutputManager> create_output_manager(
const CreateOutputManagerInfo &) const;
+
+ void set_want_choice_enabled(const ChoicePrefixName &, const UnprefixedChoiceName &, const Tribool);
};
}
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index a67332d..357bd49 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -179,6 +179,20 @@ e_repository_TEST_ever_LDADD = \
e_repository_TEST_ever_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+e_repository_TEST_phases_SOURCES = e_repository_TEST_phases.cc
+
+e_repository_TEST_phases_LDADD = \
+ libpaludiserepository_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/repositories/fake/libpaludisfakerepository_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
+e_repository_TEST_phases_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+
e_repository_TEST_exlibs_SOURCES = e_repository_TEST_exlibs.cc
e_repository_TEST_exlibs_LDADD = \
@@ -387,6 +401,9 @@ EXTRA_DIST = \
e_repository_TEST_ever.cc \
e_repository_TEST_ever_setup.sh \
e_repository_TEST_ever_cleanup.sh \
+ e_repository_TEST_phases.cc \
+ e_repository_TEST_phases_setup.sh \
+ e_repository_TEST_phases_cleanup.sh \
e_repository_TEST_exlibs.cc \
e_repository_TEST_exlibs_setup.sh \
e_repository_TEST_exlibs_cleanup.sh \
@@ -437,6 +454,7 @@ BUILT_SOURCES = \
check_SCRIPTS = \
e_repository_TEST_setup.sh e_repository_TEST_cleanup.sh \
e_repository_TEST_ever_setup.sh e_repository_TEST_ever_cleanup.sh \
+ e_repository_TEST_phases_setup.sh e_repository_TEST_phases_cleanup.sh \
e_repository_TEST_exlibs_setup.sh e_repository_TEST_exlibs_cleanup.sh \
e_repository_TEST_replacing_setup.sh e_repository_TEST_replacing_cleanup.sh \
xml_things_TEST_setup.sh xml_things_TEST_cleanup.sh \
@@ -528,6 +546,7 @@ TESTS = \
dep_spec_pretty_printer_TEST \
e_repository_TEST \
e_repository_TEST_ever \
+ e_repository_TEST_phases \
e_repository_TEST_exlibs \
e_repository_TEST_replacing \
e_repository_sets_TEST \
diff --git a/paludis/repositories/e/e_repository_TEST_phases.cc b/paludis/repositories/e/e_repository_TEST_phases.cc
new file mode 100644
index 0000000..aca1607
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_phases.cc
@@ -0,0 +1,200 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/e_repository.hh>
+#include <paludis/repositories/e/e_repository_exceptions.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/repositories/e/vdb_repository.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/fake/fake_installed_repository.hh>
+#include <paludis/repositories/fake/fake_package_id.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/set.hh>
+#include <paludis/output_manager.hh>
+#include <paludis/standard_output_manager.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/action.hh>
+#include <paludis/stringify_formatter.hh>
+#include <paludis/user_dep_spec.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/selection.hh>
+#include <paludis/repository_factory.hh>
+#include <paludis/choice.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+#include <tr1/functional>
+#include <set>
+#include <string>
+
+#include "config.h"
+
+using namespace test;
+using namespace paludis;
+
+namespace
+{
+ void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
+ {
+ if (id)
+ throw InternalError(PALUDIS_HERE, "cannot uninstall");
+ }
+
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
+ std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
+ const std::string & k)
+ {
+ Map<std::string, std::string>::ConstIterator mm(m->find(k));
+ if (m->end() == mm)
+ return "";
+ else
+ return mm->second;
+ }
+
+ WantPhase want_all_phases(const std::string &)
+ {
+ return wp_yes;
+ }
+
+ struct PhasesTest : TestCase
+ {
+ const std::string test;
+ const bool expect_pass;
+ const bool expect_slow_test;
+
+ PhasesTest(const std::string & s, const bool p, const bool t) :
+ TestCase("ever " + s),
+ test(s),
+ expect_pass(p),
+ expect_slow_test(t)
+ {
+ }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ virtual void extra_settings(TestEnvironment &)
+ {
+ }
+
+ void run()
+ {
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "yes", 1);
+#else
+ ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "", 1);
+#endif
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::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", stringify(FSEntry::cwd() / "e_repository_TEST_phases_dir" / "repo1"));
+ keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_phases_dir" / "repo1/profiles/profile"));
+ keys->insert("layout", "exheres");
+ keys->insert("eapi_when_unknown", "exheres-0");
+ keys->insert("eapi_when_unspecified", "exheres-0");
+ keys->insert("profile_eapi", "exheres-0");
+ keys->insert("distdir", stringify(FSEntry::cwd() / "e_repository_TEST_phases_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_phases_dir" / "build"));
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(&env, RepositoryName("installed")));
+ installed_repo->add_version("cat", "pretend-installed", "0")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
+ installed_repo->add_version("cat", "pretend-installed", "1")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
+ env.package_database()->add_repository(2, installed_repo);
+
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ std::tr1::shared_ptr<Map<std::string, std::string> > iv_keys(new Map<std::string, std::string>);
+ iv_keys->insert("root", "/");
+ iv_keys->insert("format", "installed_virtuals");
+ env.package_database()->add_repository(-2, RepositoryFactory::get_instance()->create(&env,
+ std::tr1::bind(from_keys, iv_keys, std::tr1::placeholders::_1)));
+ std::tr1::shared_ptr<Map<std::string, std::string> > v_keys(new Map<std::string, std::string>);
+ v_keys->insert("format", "virtuals");
+ env.package_database()->add_repository(-2, RepositoryFactory::get_instance()->create(&env,
+ std::tr1::bind(from_keys, v_keys, std::tr1::placeholders::_1)));
+#endif
+
+ extra_settings(env);
+
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::destination>(installed_repo),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
+ value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
+ value_for<n::want_phase>(&want_all_phases)
+ ));
+
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/" + test,
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(!! id->choices_key()->value()->find_by_name_with_prefix(
+ ChoiceNameWithPrefix("build_options:slow_tests")), expect_slow_test);
+
+ if (expect_pass)
+ id->perform_action(action);
+ else
+ TEST_CHECK_THROWS(id->perform_action(action), InstallActionError);
+ }
+ };
+}
+
+namespace test_cases
+{
+ PhasesTest test_no("no-slow-test", true, false);
+ PhasesTest test_pass("slow-test", true, true);
+ PhasesTest test_fail("slow-test-fail", true, true);
+
+ struct TestFailEnabled : PhasesTest
+ {
+ TestFailEnabled() :
+ PhasesTest("slow-test-fail", false, true)
+ {
+ }
+
+ void extra_settings(TestEnvironment & env)
+ {
+ env.set_want_choice_enabled(ChoicePrefixName("build_options"), UnprefixedChoiceName("slow_tests"), true);
+ }
+ } test_fail_enabled;
+}
+
diff --git a/paludis/repositories/e/e_repository_TEST_phases_cleanup.sh b/paludis/repositories/e/e_repository_TEST_phases_cleanup.sh
new file mode 100755
index 0000000..c29ca8d
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_phases_cleanup.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d e_repository_TEST_phases_dir ] ; then
+ rm -fr e_repository_TEST_phases_dir
+else
+ true
+fi
+
diff --git a/paludis/repositories/e/e_repository_TEST_phases_setup.sh b/paludis/repositories/e/e_repository_TEST_phases_setup.sh
new file mode 100755
index 0000000..7c0de76
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_phases_setup.sh
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir e_repository_TEST_phases_dir || exit 1
+cd e_repository_TEST_phases_dir || exit 1
+
+mkdir -p root/etc
+
+mkdir -p vdb
+touch vdb/THISISTHEVDB
+
+mkdir -p build
+ln -s build symlinked_build
+
+mkdir -p distdir
+
+mkdir -p repo1/{profiles/profile,metadata,eclass} || exit 1
+cd repo1 || exit 1
+echo "test-repo-1" >> profiles/repo_name || exit 1
+cat <<END > profiles/profile/virtuals
+virtual/virtual-pretend-installed cat/pretend-installed
+virtual/virtual-doesnotexist cat/doesnotexist
+END
+echo "cat" >> metadata/categories.conf || exit 1
+cat <<END > profiles/profile/make.defaults
+CHOST="i286-badger-linux-gnu"
+SUBOPTIONS="LINGUAS"
+LINGUAS="en en_GB en_GB@UTF-8"
+USERLAND="GNU"
+OPTIONS="weasel spinach"
+END
+mkdir -p "packages/cat/no-slow-test"
+cat <<'END' > packages/cat/no-slow-test/no-slow-test-1.0.exheres-0 || exit 1
+DESCRIPTION="foo"
+SUMMARY="foo"
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS="spork"
+LICENCES="GPL-2"
+PLATFORMS="test"
+END
+mkdir -p "packages/cat/slow-test"
+cat <<'END' > packages/cat/slow-test/slow-test-1.0.exheres-0 || exit 1
+DESCRIPTION="foo"
+SUMMARY="foo"
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS="spork"
+LICENCES="GPL-2"
+PLATFORMS="test"
+
+src_test_slow() {
+ true
+}
+END
+mkdir -p "packages/cat/slow-test-fail"
+cat <<'END' > packages/cat/slow-test-fail/slow-test-fail-1.0.exheres-0 || exit 1
+DESCRIPTION="foo"
+SUMMARY="foo"
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS="spork"
+LICENCES="GPL-2"
+PLATFORMS="test"
+
+src_test_slow() {
+ die
+}
+END
+cd ..
+
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index 59a6330..0d0ff62 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -232,6 +232,7 @@ namespace
value_for<n::fancy_test_flag>(check_get(k, "fancy_test_flag")),
value_for<n::has_optional_tests>(destringify_key<bool>(k, "has_optional_tests")),
value_for<n::has_recommended_tests>(destringify_key<bool>(k, "has_recommended_tests")),
+ value_for<n::has_slow_tests>(destringify_key<bool>(k, "has_slow_tests")),
value_for<n::use_expand_separator>(destringify_key<char>(k, "use_expand_separator"))
)));
}
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index a26cd88..b68741e 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -99,6 +99,7 @@ namespace paludis
struct flat_list_index;
struct has_optional_tests;
struct has_recommended_tests;
+ struct has_slow_tests;
struct homepage;
struct ignore_pivot_env_functions;
struct ignore_pivot_env_variables;
@@ -258,6 +259,7 @@ namespace paludis
NamedValue<n::fancy_test_flag, std::string> fancy_test_flag;
NamedValue<n::has_optional_tests, bool> has_optional_tests;
NamedValue<n::has_recommended_tests, bool> has_recommended_tests;
+ NamedValue<n::has_slow_tests, bool> has_slow_tests;
NamedValue<n::use_expand_separator, char> use_expand_separator;
};
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index fea74db..0a48e71 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -25,6 +25,7 @@ userpriv_cannot_use_root = false
has_optional_tests = true
has_recommended_tests = false
+has_slow_tests = false
fancy_test_flag = test
vdb_from_env_variables = \
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 46e9a54..72eda34 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -29,6 +29,7 @@ ignore_pivot_env_variables =
userpriv_cannot_use_root = true
has_optional_tests = false
has_recommended_tests = true
+has_slow_tests = true
vdb_from_env_variables = \
CATEGORY CHOST DEPENDENCIES SUMMARY EAPI \
@@ -104,7 +105,7 @@ ebuild_functions = \
builtin_saveenv builtin_tidyup builtin_variable \
pkg_config pkg_info pkg_nofetch pkg_postinst pkg_postrm \
pkg_preinst pkg_prerm pkg_pretend pkg_setup pkg_bad_options \
- src_compile src_configure src_install src_prepare src_test src_unpack
+ src_compile src_configure src_install src_prepare src_test src_test_slow src_unpack
ebuild_install = \
skipname=killold : killold ; \
@@ -115,6 +116,7 @@ ebuild_install = \
skipname=configure skipifno=*sources,unpack,prepare,configure sandbox userpriv clearenv : loadenv configure saveenv ; \
skipname=compile skipifno=*sources,unpack,prepare,configure,compile sandbox userpriv clearenv : loadenv compile saveenv ; \
skipname=test skipifno=*sources,unpack,prepare,configure,compile,test sandbox userpriv clearenv recommended_tests : loadenv test saveenv ; \
+ skipname=test_slow skipifno=*sources,unpack,prepare,configure,compile,test_slow sandbox userpriv clearenv slow_tests : loadenv test_slow saveenv ; \
skipname=install skipifno=*sources,unpack,prepare,configure,compile,test,install sandbox clearenv : loadenv install saveenv ; \
skipname=strip strip : ; \
skipname=preinst skipifno=preinst sandbox clearenv prepost : loadenv preinst saveenv ; \
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index e679851..f7d81a1 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -26,6 +26,7 @@ ignore_pivot_env_functions =
userpriv_cannot_use_root = false
has_optional_tests = false
has_recommended_tests = true
+has_slow_tests = false
vdb_from_env_variables = \
CATEGORY CHOST COUNTER DEPEND DESCRIPTION EAPI FEATURES \
diff --git a/paludis/repositories/e/ebuild/exheres-0/Makefile.am b/paludis/repositories/e/ebuild/exheres-0/Makefile.am
index 451e963..c22f0d3 100644
--- a/paludis/repositories/e/ebuild/exheres-0/Makefile.am
+++ b/paludis/repositories/e/ebuild/exheres-0/Makefile.am
@@ -38,6 +38,7 @@ libexecprogexheres_SCRIPTS = \
src_configure.bash \
src_install.bash \
src_test.bash \
+ src_test_slow.bash \
src_prepare.bash \
src_unpack.bash
diff --git a/paludis/repositories/e/ebuild/exheres-0/src_test_slow.bash b/paludis/repositories/e/ebuild/exheres-0/src_test_slow.bash
new file mode 100644
index 0000000..e68c3fb
--- /dev/null
+++ b/paludis/repositories/e/ebuild/exheres-0/src_test_slow.bash
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+#
+# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005
+# Gentoo Foundation and distributed under the terms of the GNU General
+# Public License v2.
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License, version 2, as published by the Free Software Foundation.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+default_src_test_slow()
+{
+ :
+}
+
+src_test_slow()
+{
+ default "$@"
+}
+
+exheres_internal_test_slow()
+{
+ local old_sandbox_predict="${SANDBOX_PREDICT}"
+ [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_PREDICT="${SANDBOX_PREDICT+${SANDBOX_PREDICT}:}/"
+
+ local save_PALUDIS_EXTRA_DIE_MESSAGE="${PALUDIS_EXTRA_DIE_MESSAGE}"
+
+ if [[ -d "${WORK}" ]] ; then
+ cd "${WORK}" || die "cd to \${WORK} (\"${WORK}\") failed"
+ elif [[ -d "${WORKBASE}" ]] ; then
+ cd "${WORKBASE}" || die "cd to \${WORKBASE} (\"${WORKBASE}\") failed"
+ fi
+
+ if hasq "test_slow" ${SKIP_FUNCTIONS} ; then
+ ebuild_section "Skipping src_test_slow (SKIP_FUNCTIONS)"
+ else
+ ebuild_section "Starting src_test_slow"
+ src_test_slow
+ ebuild_section "Done src_test_slow"
+ fi
+
+ export PALUDIS_EXTRA_DIE_MESSAGE="${save_PALUDIS_EXTRA_DIE_MESSAGE}"
+
+ [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] && SANDBOX_PREDICT="${old_sandbox_predict}"
+ true
+}
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index d50b17b..eb100a9 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -768,6 +768,13 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
if (choice && ! choice->enabled())
continue;
}
+ else if (phase->option("slow_tests"))
+ {
+ std::tr1::shared_ptr<const ChoiceValue> choice(id->choices_key()->value()->find_by_name_with_prefix(
+ ELikeSlowTestsChoiceValue::canonical_name_with_prefix()));
+ if (choice && ! choice->enabled())
+ continue;
+ }
EbuildCommandParams command_params(make_named_values<EbuildCommandParams>(
value_for<n::builddir>(_imp->params.builddir()),
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 4009201..e77773c 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1332,6 +1332,31 @@ EbuildID::add_build_options(const std::tr1::shared_ptr<Choices> & choices) const
if (may_be_unrestricted_test)
build_options->add(make_shared_ptr(new ELikeRecommendedTestsChoiceValue(shared_from_this(), _imp->environment, build_options)));
+ /* slow_tests */
+ if (eapi()->supported()->choices_options()->has_slow_tests())
+ {
+ if (! _imp->defined_phases)
+ throw InternalError(PALUDIS_HERE, "bug! no defined_phases yet");
+
+ bool has_slow_test_phase(false);
+ EAPIPhases phases(_imp->eapi->supported()->ebuild_phases()->ebuild_install());
+ for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
+ phase != phase_end ; ++phase)
+ {
+ if (phase->option("slow_tests"))
+ {
+ if (_imp->defined_phases->value()->end() != _imp->defined_phases->value()->find(phase->equal_option("skipname")))
+ {
+ has_slow_test_phase = true;
+ break;
+ }
+ }
+ }
+
+ if (has_slow_test_phase)
+ build_options->add(make_shared_ptr(new ELikeSlowTestsChoiceValue(shared_from_this(), _imp->environment, build_options)));
+ }
+
/* split, strip */
if (may_be_unrestricted_strip)
{