Ticket #1246: misc-build_helper-test-1246.darcs.patch

File misc-build_helper-test-1246.darcs.patch, 12.6 KB (added by zooko, at 2011-01-01T23:55:43Z)
Line 
11 patch for repository zooko@dev.allmydata.org:/home/darcs/tahoe-lafs/trunk:
2
3Sat Jan  1 16:22:12 MST 2011  zooko@zooko.com
4  * setup: a test intended to exercise the problem described in #1246
5  However, I am not sure that this test successfully exercises that problem.
6
7New patches:
8
9[setup: a test intended to exercise the problem described in #1246
10zooko@zooko.com**20110101232212
11 Ignore-this: b4862ba48f4cb42896190b5fb27757c3
12 However, I am not sure that this test successfully exercises that problem.
13] {
14addfile ./misc/build_helpers/test-dists-in-shared-directory.py
15hunk ./misc/build_helpers/test-dists-in-shared-directory.py 1
16+#!/usr/bin/env python
17+
18+import StringIO, glob, os, platform, shutil, subprocess, sys, tarfile, zipfile
19+import pkg_resources
20+
21+def test():
22+    # We put a fake "pycryptopp 0.5.13" packagedir into a directory
23+    # named packages1, and a fake "pycryptopp 99.0.0" into a directory
24+    # named packages2, and a fake "zfec 1.1.0" packagedir into
25+    # packages1.  The "pycryptopp 0.5.13" in packages1 is
26+    # booby-trapped so that it will raise an exception when you import
27+    # it.
28+
29+    # Then we run "python setup.py test -s
30+    # buildtest.test_dists_in_shared_directory", which imports
31+    # pycryptopp and passes if pycryptopp.__version__ == '99.0.0'.
32+
33+    # (Note that for this test to make sense, tahoe-lafs needs to be
34+    # asking for a version of pycryptopp which can be satisfied by
35+    # 99.0.0 but not by 0.5.13. At the time of this writing it
36+    # requires >= 0.5.20 on x86 and >= 0.5.14 on other architectures.)
37+
38+    temp_dir = 'tmpdir-for-test-dists-in-shared-directory'
39+    fake_pkgdir1 = 'packages1'
40+    fake_pkgdir2 = 'packages2'
41+    fake_distname = "pycryptopp"
42+    fake_goodversion = "99.0.0"
43+    fake_badversion = "0.5.13"
44+    fake_goodinit = "__version__ = '%s'" % (fake_goodversion,)
45+    fake_badinit = "raise Exception('Aha I caught you trying to import me. I am a fake pycryptopp 0.5.13 package and you should be require a newer version than me.')"
46+
47+    testsuite = "buildtest.test_dists_in_shared_directory"
48+
49+    pkgdir1dirname = os.path.join(os.getcwd(), temp_dir, fake_pkgdir1)
50+    pkgdir2dirname = os.path.join(os.getcwd(), temp_dir, fake_pkgdir2)
51+
52+    try:
53+        os.makedirs(pkgdir1dirname)
54+    except OSError:
55+        # probably already exists
56+        pass
57+    try:
58+        os.makedirs(os.path.join(pkgdir1dirname, 'zfec'))
59+    except OSError:
60+        # probably already exists
61+        pass
62+    try:
63+        open(os.path.join(pkgdir1dirname, 'zfec', '__init__.py'), 'w')
64+    except OSError:
65+        # probably already exists
66+        pass
67+    zfec_egginfo_name = os.path.join(pkgdir1dirname, '%s-%s-py%s.%s-%s.egg-info' % ('zfec', '1.1.0', platform.python_version_tuple()[0], platform.python_version_tuple()[1], pkg_resources.get_supported_platform()))
68+    try:
69+        open(zfec_egginfo_name, 'w')
70+    except OSError:
71+        # probably already exists
72+        pass
73+
74+    try:
75+        os.makedirs(os.path.join(pkgdir1dirname, 'pycryptopp'))
76+    except OSError:
77+        # probably already exists
78+        pass
79+    try:
80+        open(os.path.join(pkgdir1dirname, 'pycryptopp', '__init__.py'), 'w').write(fake_badinit)
81+    except OSError:
82+        # probably already exists
83+        pass
84+    pycryptopp_egginfo_name = os.path.join(pkgdir1dirname, '%s-%s-py%s.%s-%s.egg-info' % ('pycryptopp', '0.5.13', platform.python_version_tuple()[0], platform.python_version_tuple()[1], pkg_resources.get_supported_platform()))
85+    try:
86+        open(pycryptopp_egginfo_name, 'w')
87+    except OSError:
88+        # probably already exists
89+        pass
90+
91+    try:
92+        os.makedirs(pkgdir2dirname)
93+    except OSError:
94+        # probably already exists
95+        pass
96+
97+    try:
98+        os.makedirs(os.path.join(pkgdir2dirname, 'pycryptopp'))
99+    except OSError:
100+        # probably already exists
101+        pass
102+    try:
103+        open(os.path.join(pkgdir2dirname, 'pycryptopp', '__init__.py'), 'w').write(fake_goodinit)
104+    except OSError:
105+        # probably already exists
106+        pass
107+    pycryptopp_egginfo_name = os.path.join(pkgdir2dirname, '%s-%s-py%s.%s-%s.egg' % ('pycryptopp', '0.5.24', platform.python_version_tuple()[0], platform.python_version_tuple()[1], pkg_resources.get_supported_platform()))
108+    try:
109+        open(pycryptopp_egginfo_name, 'w')
110+    except OSError:
111+        # probably already exists
112+        pass
113+
114+    os.chdir('src')
115+    trial=os.path.join(os.getcwd(), '..', 'misc', 'build_helpers', 'run_trial.py')
116+    os.environ['PATH']=os.getcwd()+os.pathsep+os.environ['PATH']
117+    eggs = [os.path.realpath(p) for p in glob.glob(os.path.join('..', '*.egg'))]
118+    os.environ['PYTHONPATH']=os.pathsep+pkgdir1dirname+os.pathsep+pkgdir2dirname+os.pathsep+os.pathsep.join(eggs)+os.pathsep+os.environ.get('PYTHONPATH','')
119+    sys.exit(subprocess.call([sys.executable, trial, testsuite], env=os.environ))
120+
121+if __name__ == '__main__':
122+    test()
123addfile ./src/buildtest/test_dists_in_shared_directory.py
124hunk ./src/buildtest/test_dists_in_shared_directory.py 1
125+#!/usr/bin/env python
126+
127+from twisted.trial import unittest
128+
129+class T(unittest.TestCase):
130+    def test_version(self):
131+        import pkg_resources
132+        pkg_resources.require('pycryptopp >= 0.5.14')
133+
134+        import zfec
135+        import pycryptopp
136+        # If you tried to import 0.5.13 then you would have gotten an
137+        # exception and stopped before you reached this line.  If
138+        # there is already a pycryptopp installed in the system then
139+        # the import might have gotten that, instead of the fake
140+        # 99.0.0 that we intended. In that case, we can't easily tell
141+        # whether we got this far because we correctly skipped over
142+        # the insufficient 0.5.13 and imported the sufficient 99.0.0,
143+        # or because the system-provided pycryptopp was found before
144+        # the insufficient 0.5.13 was found, so this test can't draw a
145+        # conclusion about whether our import machinery is working
146+        # right.
147+        if pycryptopp.__version__ != '99.0.0':
148+            raise unittest.SkipTest("We can't tell if this worked because this system has a different version of pycryptopp already installed. See comment in misc/build_helpers/test_dists_in_shared_directory.py .")
149}
150
151Context:
152
153[test_storage.py: fix a pyflakes unused import warning.
154david-sarah@jacaranda.org**20101231220756
155 Ignore-this: df08231540cb7dff9d2b038e47ab30ee
156]
157[test_storage.py: leave at least 512 MiB free when running test_large_share. refs #1195
158david-sarah@jacaranda.org**20101231203215
159 Ignore-this: b2144c0341c3452b5d4ba219e284ea0e
160]
161[storage: use fileutil's version of get_disk_stats() and get_available_space(), use mockery/fakery in tests, enable large share test on platforms with sparse files and if > 4 GiB of disk space is currently available
162zooko@zooko.com**20100910173629
163 Ignore-this: 1304f1164c661de6d5304f993eb9b27b
164]
165[fileutil: copy in the get_disk_stats() and get_available_space() functions from storage/server.py
166zooko@zooko.com**20100910173520
167 Ignore-this: 8b15569715f710f4fc5092f7ca109253
168]
169[Update foolscap version requirement to 0.6.0, to address http://foolscap.lothar.com/trac/ticket/167
170david-sarah@jacaranda.org**20101231060039
171 Ignore-this: 98d2b8086a1a500b9f4565bca5a3810
172]
173[docs/webapi.rst: typos.
174david-sarah@jacaranda.org**20101230034422
175 Ignore-this: d1f5166d72cc711f7e0d9981eac9105e
176]
177[docs/webapi.rst: capitalization, formatting of section on URL character encoding, and a correction about Internet Explorer.
178david-sarah@jacaranda.org**20101230034049
179 Ignore-this: b3b9819d2fb264b4cdc5c8afd4e8c48d
180]
181[docs: corrections and clarifications.
182david-sarah@jacaranda.org**20101227051056
183 Ignore-this: e33202858c7644c58f3f924b164294b6
184]
185[docs: more formatting cleanups and corrections. Spell webapi and wapi as web-API.
186david-sarah@jacaranda.org**20101227050533
187 Ignore-this: 18b23cbfb780df585d8a722a1ec63e94
188]
189[docs/debian.rst: bring description of building dependencies from source up-to-date, and change hostname from allmydata.com to tahoe-lafs.org.
190david-sarah@jacaranda.org**20101212222912
191 Ignore-this: f38462afc88b4475195610385a28391c
192]
193[docs/architecture.rst: correct rst syntax.
194david-sarah@jacaranda.org**20101212202003
195 Ignore-this: 3fbe12feb28bec6f1c63aedbc79aad21
196]
197[docs/architecture.rst: formatting.
198david-sarah@jacaranda.org**20101212201719
199 Ignore-this: 305fa5dfc2939355eaf6d0d2161eb1ff
200]
201[docs: linkification, wording improvements.
202david-sarah@jacaranda.org**20101212201234
203 Ignore-this: 4e67287f527a8bc728cfbd93255d2aae
204]
205[docs: formatting.
206david-sarah@jacaranda.org**20101212201115
207 Ignore-this: 2e0ed394ac7726651d3a4f2c4b0d3798
208]
209[docs/configuration.rst: more formatting tweaks; which -> that.
210david-sarah@jacaranda.org**20101212195522
211 Ignore-this: a7becb7021854ca5a90edd892b36fdd7
212]
213[docs/configuration.rst: more changes to formatting.
214david-sarah@jacaranda.org**20101212194511
215 Ignore-this: 491aac33e5f5268d224359f1447d10be
216]
217[docs/configuration.rst: changes to formatting (mainly putting commands and filenames in monospace).
218david-sarah@jacaranda.org**20101212181828
219 Ignore-this: 8a1480e2d5f43bee678476424615b50f
220]
221[scripts/backupdb.py: more accurate comment about path field.
222david-sarah@jacaranda.org**20101212170320
223 Ignore-this: 50e47a2228a85207bbcd188a78a0d4e6
224]
225[scripts/cli.py: fix missing 'put' in usage example for 'tahoe put'.
226david-sarah@jacaranda.org**20101212170207
227 Ignore-this: 2cbadf066fff611fc03d3c0ff97ce6ec
228]
229[docs/frontends/CLI.rst: changes to formatting (mainly putting commands and filenames in monospace), and to command syntax to reflect that DIRCAP/... is accepted. Clarify the syntax of 'tahoe put' and other minor corrections. Tahoe -> Tahoe-LAFS.
230david-sarah@jacaranda.org**20101212165800
231 Ignore-this: a123ef6b564aa8624d1e79c97068ea12
232]
233[docs/frontends/CLI.rst: Unicode arguments to 'tahoe' work on Windows as of v1.7.1.
234david-sarah@jacaranda.org**20101212063740
235 Ignore-this: 3977a99dfa86ac33a44171deaf43aaab
236]
237[docs/known_issues.rst: fix title and linkify another URL. refs #1225
238david-sarah@jacaranda.org**20101212062817
239 Ignore-this: cc91287f7fb51c23440b3d2fe79c449c
240]
241[docs/known_issues.rst: fix an external link. refs #1225
242david-sarah@jacaranda.org**20101212062435
243 Ignore-this: b8cbf12f353131756c358965c48060ec
244]
245[Fix a link from uri.rst to dirnodes.rst. refs #1225
246david-sarah@jacaranda.org**20101212054502
247 Ignore-this: af6205299f5c9a33229cab259c00f9d5
248]
249[Fix a link from webapi.rst to FTP-and-SFTP.rst. refs #1225
250david-sarah@jacaranda.org**20101212053435
251 Ignore-this: 2b9f88678c3447ea860d6b61e8799858
252]
253[More specific hyperlink to architecture.rst from helper.rst. refs #1225
254david-sarah@jacaranda.org**20101212052607
255 Ignore-this: 50424c768fca481252fabf58424852dc
256]
257[Update hyperlinks between docs, and linkify some external references. refs #1225
258david-sarah@jacaranda.org**20101212051459
259 Ignore-this: cd43a4c3d3de1f832abfa88d5fc4ace1
260]
261[docs/specifications/dirnodes.rst: fix references to mutable.rst. refs #1225
262david-sarah@jacaranda.org**20101212012720
263 Ignore-this: 6819b4b4e06e947ee48b365e840db37d
264]
265[docs/specifications/mutable.rst: correct the magic string for v1 mutable containers. refs #1225
266david-sarah@jacaranda.org**20101212011400
267 Ignore-this: 99a5fcdd40cef83dbb08f323f6cdaaca
268]
269[Move .txt files in docs/frontends and docs/specifications to .rst. refs #1225
270david-sarah@jacaranda.org**20101212010251
271 Ignore-this: 8796d35d928370f7dc6ad2dafdc1c0fe
272]
273[Convert docs/frontends and docs/specifications to reStructuredText format (not including file moves).
274david-sarah@jacaranda.org**20101212004632
275 Ignore-this: e3ceb2d832d73875abe48624ddbb5622
276]
277[scripts/cli.py: remove the disclaimer in the help for 'tahoe cp' that it does not handle non-ASCII filenames well. (At least, we intend to handle them.)
278david-sarah@jacaranda.org**20101130002145
279 Ignore-this: 94c003efaa20b9eb4a83503d79844ca
280]
281[relnotes.txt: fifth -> sixth labor-of-love release
282zooko@zooko.com**20101129045647
283 Ignore-this: 21c245015268b38916e3a138d256c09d
284]
285[Makefile: BB_BRANCH is set to the empty string for trunk, not the string 'trunk'.
286david-sarah@jacaranda.org**20101128233512
287 Ignore-this: 5a7ef8eb10475636d21b91e25b56c369
288]
289[relnotes.txt: eleventh -> twelfth release.
290david-sarah@jacaranda.org**20101128223321
291 Ignore-this: 1e26410156a665271c1170803dea2c0d
292]
293[relnotes.tst: point to known_issues.rst, not known_issues.txt.
294david-sarah@jacaranda.org**20101128222918
295 Ignore-this: 60194eb4544cac446fe4f60b3e34b887
296]
297[quickstart.html: fix link to point to allmydata-tahoe-1.8.1.zip.
298david-sarah@jacaranda.org**20101128221728
299 Ignore-this: 7b3ee86f8256aa12f5d862f689f3ee29
300]
301[TAG allmydata-tahoe-1.8.1
302david-sarah@jacaranda.org**20101128212336
303 Ignore-this: 9c18bdeaef4822f590d2a0d879e00621
304]
305Patch bundle hash:
306eef4a269fe41d540ae877395ecc3d94332744d89