Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/emerge/
Date: Mon, 17 Oct 2011 01:47:11
Message-Id: c2025582e2abce8422ed6a191202fb899820b525.zmedico@gentoo
1 commit: c2025582e2abce8422ed6a191202fb899820b525
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon Oct 17 01:46:41 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Mon Oct 17 01:46:41 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c2025582
7
8 tests/emerge: test --regen and --metadata
9
10 ---
11 pym/portage/tests/emerge/test_simple.py | 42 +++++++++++++++++++++++++++---
12 1 files changed, 37 insertions(+), 5 deletions(-)
13
14 diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
15 index 70d4918..ccaf580 100644
16 --- a/pym/portage/tests/emerge/test_simple.py
17 +++ b/pym/portage/tests/emerge/test_simple.py
18 @@ -126,6 +126,10 @@ src_install() {
19 trees = playground.trees
20 root = playground.root
21 portdb = trees[root]["porttree"].dbapi
22 + portdir = settings["PORTDIR"]
23 + var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")
24 + cachedir = os.path.join(var_cache_edb, "dep")
25 + cachedir_pregen = os.path.join(portdir, "metadata", "cache")
26
27 portage_python = portage._python_interpreter
28 ebuild_cmd = (portage_python, "-Wd",
29 @@ -147,6 +151,11 @@ src_install() {
30 regenworld_cmd = (portage_python, "-Wd",
31 os.path.join(PORTAGE_BIN_PATH, "regenworld"))
32
33 + rm_binary = find_binary("rm")
34 + self.assertEqual(rm_binary is None, False,
35 + "rm command not found")
36 + rm_cmd = (rm_binary,)
37 +
38 egencache_extra_args = []
39 if self._have_python_xml():
40 egencache_extra_args.append("--update-use-local-desc")
41 @@ -156,10 +165,27 @@ src_install() {
42
43 test_commands = (
44 env_update_cmd,
45 - egencache_cmd + ("--update",) + tuple(egencache_extra_args),
46 emerge_cmd + ("--version",),
47 emerge_cmd + ("--info",),
48 emerge_cmd + ("--info", "--verbose"),
49 + rm_cmd + ("-rf", cachedir),
50 + rm_cmd + ("-rf", cachedir_pregen),
51 + emerge_cmd + ("--regen",),
52 + rm_cmd + ("-rf", cachedir),
53 + ({"FEATURES" : "metadata-transfer"},) + \
54 + emerge_cmd + ("--regen",),
55 + rm_cmd + ("-rf", cachedir),
56 + ({"FEATURES" : "metadata-transfer parse-eapi-ebuild-head"},) + \
57 + emerge_cmd + ("--regen",),
58 + rm_cmd + ("-rf", cachedir),
59 + egencache_cmd + ("--update",) + tuple(egencache_extra_args),
60 + ({"FEATURES" : "metadata-transfer"},) + \
61 + emerge_cmd + ("--metadata",),
62 + rm_cmd + ("-rf", cachedir),
63 + ({"FEATURES" : "metadata-transfer"},) + \
64 + emerge_cmd + ("--metadata",),
65 + emerge_cmd + ("--metadata",),
66 + rm_cmd + ("-rf", cachedir),
67 emerge_cmd + ("--pretend", "dev-libs/A"),
68 ebuild_cmd + (test_ebuild, "manifest", "clean", "package", "merge"),
69 emerge_cmd + ("--pretend", "--tree", "--complete-graph", "dev-libs/A"),
70 @@ -193,10 +219,8 @@ src_install() {
71 pkgdir = os.path.join(eprefix, "pkgdir")
72 fake_bin = os.path.join(eprefix, "bin")
73 portage_tmpdir = os.path.join(eprefix, "var", "tmp", "portage")
74 - portdir = settings["PORTDIR"]
75 profile_path = settings.profile_path
76 user_config_dir = os.path.join(os.sep, eprefix, USER_CONFIG_PATH)
77 - var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")
78
79 features = []
80 if not portage.process.sandbox_capable:
81 @@ -250,7 +274,8 @@ src_install() {
82 }
83
84 updates_dir = os.path.join(portdir, "profiles", "updates")
85 - dirs = [distdir, fake_bin, portage_tmpdir, updates_dir,
86 + dirs = [cachedir, cachedir_pregen, distdir, fake_bin,
87 + portage_tmpdir, updates_dir,
88 user_config_dir, var_cache_edb]
89 true_symlinks = ["chown", "chgrp"]
90 true_binary = find_binary("true")
91 @@ -289,8 +314,15 @@ move dev-util/git dev-vcs/git
92
93 for args in test_commands:
94
95 + if isinstance(args[0], dict):
96 + local_env = env.copy()
97 + local_env.update(args[0])
98 + args = args[1:]
99 + else:
100 + local_env = env
101 +
102 proc = subprocess.Popen(args,
103 - env=env, stdout=stdout)
104 + env=local_env, stdout=stdout)
105
106 if debug:
107 proc.wait()