import zend standard tests
[hiphop-php.git] / hphp / tools / import_zend_test.py
blob50446c650788660a4d2031bfc011ba12f395edb6
1 #!/usr/bin/env python
3 """
4 Copies all the Zend tests to a temporary directory, runs them in interp mode,
5 then copies the good ones to test/zend/good and the bad ones to test/zend/bad.
6 """
8 import argparse
9 import glob
10 import json
11 import os
12 import re
13 import shutil
14 import subprocess
15 import sys
17 # Don't even pull these into the repo.
18 # We want runnig the bad tests to still complete.
19 no_import = (
20 # these hang forever
21 '/ext/sockets/tests/socket_select-wrongparams-1.phpt',
22 '/ext/spl/tests/array_012.phpt',
23 '/ext/spl/tests/observer_003.phpt',
24 '/ext/spl/tests/observer_004.phpt',
25 '/ext/spl/tests/observer_005.phpt',
26 '/ext/spl/tests/observer_006.phpt',
27 '/ext/spl/tests/observer_009.phpt',
28 '/ext/standard/tests/array/array_pad_variation2.phpt',
29 '/ext/standard/tests/file/bug27508.phpt',
30 '/ext/standard/tests/general_functions/sleep_error.phpt',
31 '/ext/standard/tests/general_functions/usleep_error.phpt',
32 '/ext/zlib/tests/gzgetc_basic.phpt',
33 '/ext/zlib/tests/gzgets_basic.phpt',
34 '/tests/func/005a.phpt',
35 '/tests/run-test/test010.phpt',
37 # segfaults
38 '/Zend/tests/020.phpt',
39 '/Zend/tests/bug35239.phpt',
40 '/Zend/tests/bug54265.phpt',
41 '/Zend/tests/bug55705.phpt',
42 '/Zend/tests/callable_type_hint_001.phpt',
43 '/Zend/tests/callable_type_hint_003.phpt',
44 '/Zend/tests/heredoc_005.phpt',
45 '/Zend/tests/jump13.phpt',
46 '/ext/bz2/tests/004.phpt',
47 '/ext/date/tests/bug50055.phpt',
48 '/ext/gd/tests/crafted_gd2.phpt',
49 '/ext/pcntl/tests/pcntl_exec.phpt',
50 '/ext/pcntl/tests/pcntl_exec_2.phpt',
51 '/ext/pcntl/tests/pcntl_exec_3.phpt',
52 '/ext/session/tests/bug61728.phpt',
53 '/ext/session/tests/session_module_name_variation2.phpt',
54 '/tests/func/010.phpt',
55 '/tests/lang/bug21820.phpt',
56 '/tests/lang/func_get_arg.003.phpt',
57 '/tests/lang/func_get_args.003.phpt',
58 '/tests/lang/func_num_args.003.phpt',
59 '/tests/lang/operators/divide_basiclong_64bit.phpt',
60 '/tests/lang/operators/modulus_basiclong_64bit.phpt',
62 # intermittent segfaults
63 '/Zend/tests/001.phpt',
64 '/Zend/tests/002.phpt',
65 '/Zend/tests/003.phpt',
67 # spews files until they work
68 '/ext/spl/tests/SplFileInfo_getExtension_basic.phpt',
69 '/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt',
70 '/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt',
71 '/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt',
72 '/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt',
73 '/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt',
74 '/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt',
75 '/ext/spl/tests/SplFileObject_fgetcsv_escape_default.phpt',
76 '/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt',
77 '/ext/spl/tests/SplFileObject_getflags_basic.phpt',
78 '/ext/spl/tests/SplFileObject_getflags_error001.phpt',
79 '/ext/spl/tests/SplFileObject_getflags_error002.phpt',
80 '/ext/spl/tests/SplFileObject_rewind_error001.phpt',
81 '/ext/spl/tests/SplFileObject_setCsvControl_basic.phpt',
82 '/ext/spl/tests/SplFileObject_setCsvControl_error001.phpt',
83 '/ext/spl/tests/SplFileObject_setCsvControl_error002.phpt',
84 '/ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt',
85 '/ext/standard/tests/file/fopen_variation14-win32.phpt',
86 '/ext/standard/tests/file/fopen_variation15-win32.phpt',
87 '/ext/standard/tests/file/mkdir_variation5-win32.phpt',
88 '/ext/standard/tests/file/mkdir_variation5-win32.phpt',
89 '/ext/standard/tests/file/readfile_variation4.phpt',
90 '/ext/standard/tests/file/windows_links/bug48746.phpt',
91 '/ext/standard/tests/file/windows_links/bug48746_1.phpt',
92 '/ext/standard/tests/file/windows_links/bug48746_2.phpt',
93 '/ext/xmlwriter/tests/001.phpt',
94 '/ext/xmlwriter/tests/004.phpt',
95 '/ext/xmlwriter/tests/005.phpt',
96 '/ext/xmlwriter/tests/006.phpt',
97 '/ext/xmlwriter/tests/OO_001.phpt',
98 '/ext/xmlwriter/tests/OO_004.phpt',
99 '/ext/xmlwriter/tests/OO_005.phpt',
100 '/ext/xmlwriter/tests/OO_006.phpt',
102 # not tests
103 '/ext/xmlwriter/examples/',
105 # not implemented extensions
106 '/ext/calendar',
107 '/ext/com_dotnet',
108 '/ext/dba',
109 '/ext/dom',
110 '/ext/enchant',
111 '/ext/ereg',
112 '/ext/fileinfo',
113 '/ext/filter',
114 '/ext/ftp',
115 '/ext/gettext',
116 '/ext/gmp',
117 '/ext/interbase',
118 '/ext/mssql',
119 '/ext/mysqli',
120 '/ext/mysqlnd',
121 '/ext/oci8',
122 '/ext/odbc',
123 '/ext/pdo_dblib',
124 '/ext/pdo_firebird',
125 '/ext/pdo_oci',
126 '/ext/pdo_odbc',
127 '/ext/pdo_pgsql',
128 '/ext/phar',
129 '/ext/pspell',
130 '/ext/readline',
131 '/ext/recode',
132 '/ext/reflection',
133 '/ext/shmop',
134 '/ext/skeleton',
135 '/ext/snmp',
136 '/ext/sybase_ct',
137 '/ext/sysvmsg',
138 '/ext/sysvsem',
139 '/ext/sysvshm',
140 '/ext/tidy',
141 '/ext/tokenizer',
142 '/ext/wddx',
143 '/ext/xmlrpc',
144 '/ext/xsl',
145 '/ext/zip',
146 '/sapi',
149 # For mark these as failing
150 bad_tests = (
151 # SESSION is bused on husdon
152 '/zend/unset_cv05.php',
153 '/zend/unset_cv06.php',
155 # unpredictable numbers - we need param matching
156 '/ext-date/bug35143.php',
157 '/ext-date/gettimeofday_basic.php',
158 '/ext-date/localtime_basic.php',
159 '/ext-date/time_basic.php',
160 '/ext-openssl/openssl_random_pseudo_bytes.php',
161 '/ext-pcntl/pcntl_fork_basic.php',
162 '/ext-posix/posix_getpgid_basic.php',
163 '/ext-posix/posix_getpgrp_basic.php',
164 '/ext-posix/posix_getpid_basic.php',
165 '/ext-posix/posix_getppid_basic.php',
166 '/ext-posix/posix_getsid_basic.php',
167 '/ext-posix/posix_times.php',
168 '/ext-posix/posix_times_basic.php',
169 '/ext-sockets/socket_getsockname.php',
170 '/ext-standard/array/array_diff_assoc_variation6.php',
171 '/ext-standard/file/fileinode_variation1.php',
172 '/ext-standard/file/filestat.php',
173 '/ext-standard/fstat.php',
174 '/ext-standard/fstat_basic.php',
175 '/ext-standard/general_functions/bug39322.php',
176 '/ext-standard/general_functions/getmypid_basic.php',
177 '/ext-standard/general_functions/getrusage_basic.php',
178 '/ext-standard/touch_basic.php',
179 '/tests-basic/bug29971.php',
181 # not implemented extensions
182 'phar', # this appears in filenames
184 # works in interp but not others
185 '/tests-lang/bug25922.php',
186 '/zend/bug34064.php',
187 '/zend/objects_029.php',
188 '/zend/objects_030.php',
189 '/ext-standard-strings/bug44242.php',
191 # line number is inconsistent on stack overflow
192 '/zend/bug41633_3.php',
194 # broken in Jenkins
195 '/ext-standard-array/array_diff_assoc_variation6.php',
196 '/zend/bug35239.php',
197 '/zend/bug54265.php',
199 # our build machines have no members in group 0...
200 '/ext-posix/posix_getgrgid.php',
203 # Random other files that zend wants
204 other_files = (
205 '/ext-curl/curl_testdata1.txt',
206 '/ext-curl/curl_testdata2.txt',
207 '/ext-exif/bug48378.jpeg',
208 '/ext-gd/Tuffy.ttf',
209 '/ext-gd/bug37346.gif',
210 '/ext-gd/bug38112.gif',
211 '/ext-gd/bug43121.gif',
212 '/ext-gd/conv_test.gif',
213 '/ext-gd/conv_test.jpeg',
214 '/ext-gd/conv_test.png',
215 '/ext-gd/conv_test.xbm',
216 '/ext-gd/php.gif',
217 '/ext-gd/src.gd2',
218 '/ext-gd/src.wbmp',
219 '/ext-gd/test8859.ttf',
220 '/ext-gd/test_gif.gif',
221 '/ext-intl/ut_common.inc',
222 '/ext-ldap/connect.inc',
223 '/ext-mbstring/common.inc',
224 '/ext-mcrypt/vectors.txt',
225 '/ext-mysql/connect.inc',
226 '/ext-openssl/005_crt.txt',
227 '/ext-openssl/bug37820cert.pem',
228 '/ext-openssl/bug37820key.pem',
229 '/ext-openssl/bug39217cert1.txt',
230 '/ext-openssl/bug39217cert2.txt',
231 '/ext-openssl/cert.crt',
232 '/ext-openssl/openssl.cnf',
233 '/ext-openssl/private.key',
234 '/ext-openssl/public.key',
235 '/ext-pdo/pdo_test.inc',
236 '/ext-pdo_mysql/config.inc',
237 '/ext-pdo_mysql/common.phpt',
238 '/ext-pdo_sqlite/config.inc',
239 '/ext-pdo_sqlite/common.phpt',
240 '/ext-session/save_handler.inc',
241 '/ext-simplexml/bug24392.xml',
242 '/ext-soap-bugs/bug30928.wsdl',
243 '/ext-soap-bugs/bug41337.wsdl',
244 '/ext-soap-bugs/bug42692.wsdl',
245 '/ext-soap-schema/test_schema.inc',
246 '/ext-soap-soap12/soap12-test.inc',
247 '/ext-soap-soap12/soap12-test.wsdl',
248 '/ext-spl/testclass.class.inc',
249 '/ext-sqlite3/new_db.inc',
250 '/ext-sqlite3/stream_test.inc',
251 '/ext-standard-general_functions/004.data',
252 '/ext-standard-array/compare_function.inc',
253 '/ext-standard-class_object/AutoLoaded.inc',
254 '/ext-standard-class_object/AutoInterface.inc',
255 '/ext-standard-class_object/AutoTrait.inc',
256 '/ext-standard-file/test.csv',
257 '/ext-standard-file/test2.csv',
258 '/ext-standard-file/test3.csv',
259 '/ext-standard-file/fopen_include_path.inc',
260 '/ext-standard-general_functions/bug41445.ini',
261 '/ext-standard-image/bug13213.jpg',
262 '/ext-standard-image/246x247.png',
263 '/ext-standard-image/384x385.png',
264 '/ext-standard-image/testAPP.jpg',
265 '/ext-standard-image/test13pix.swf',
266 '/ext-standard-image/test1pix.jpg',
267 '/ext-standard-serialize/autoload_implements.p5c',
268 '/ext-standard-serialize/autoload_interface.p5c',
269 '/ext-xml/xmltest.xml',
270 '/ext-xmlreader/012.dtd',
271 '/ext-xmlreader/012.xml',
272 '/ext-xmlreader/dtdexample.dtd',
273 '/ext-xmlreader/relaxNG.rng',
274 '/ext-xmlreader/relaxNG2.rng',
275 '/ext-xmlreader/relaxNG3.rng',
276 '/ext-zlib/004.txt.gz',
277 '/tests-classes/autoload_derived.p5c',
278 '/tests-classes/autoload_implements.p5c',
279 '/tests-classes/autoload_interface.p5c',
280 '/tests-classes/autoload_root.p5c',
281 '/tests-classes/constants_basic_003.inc',
282 '/tests-classes/interface_optional_arg_003.inc',
283 '/tests-lang/015.inc',
284 '/tests-lang/016.inc',
285 '/tests-lang/023-2.inc',
286 '/tests-lang/inc.inc',
287 '/tests-lang/inc_throw.inc',
288 '/tests/quicktester.inc',
289 '/zend/bug54804.inc',
290 '/zend/nowdoc.inc',
291 '/zend/ns_022.inc',
292 '/zend/ns_027.inc',
293 '/zend/ns_028.inc',
294 '/zend/ns_065.inc',
295 '/zend/ns_066.inc',
296 '/zend/ns_067.inc',
297 '/zend/unset.inc',
300 # Map strings from one style to another
301 errors = (
302 # generic inconsistencies
303 ('Variable passed to ([^\s]+)\(\) is not an array or object',
304 'Invalid operand type was used: expecting an array'),
305 ('bcdiv\(\): ', ''),
306 ('bcsqrt\(\): ', ''),
307 ('bcpowmod\(\): ', ''),
310 parser = argparse.ArgumentParser()
311 parser.add_argument(
312 "-z",
313 "--zend_path",
314 type=str,
315 help="zend path to import tests from."
317 parser.add_argument(
318 "-o",
319 "--only",
320 type=str,
321 action='append',
322 help="only import tests whose path matches this regex."
324 parser.add_argument(
325 "--dirty",
326 action='store_true',
327 help="leave around test/zend/all directory."
329 parser.add_argument(
330 "-v",
331 "--verbose",
332 action='store_true',
333 help="print out extra stuff."
335 args = parser.parse_args()
338 def mkdir_p(path):
339 try:
340 os.makedirs(path)
341 except OSError as exc: # Python >2.5
342 pass
344 def walk(filename, source):
345 dest_filename = os.path.basename(filename)
346 source_dir = source.lower().replace('/tests', '').replace('/', '-')
348 cur_dir = os.path.dirname(__file__)
349 dest_subdir = os.path.join(cur_dir, '../test/zend/all', source_dir)
350 mkdir_p(dest_subdir)
351 full_dest_filename = os.path.join(dest_subdir, dest_filename)
353 # Exactly mirror zend's directories incase some tests depend on random crap.
354 # We'll only move things we want into 'good'
355 shutil.copyfile(filename, full_dest_filename)
357 full_dest_filename = full_dest_filename.replace('.phpt', '.php')
359 if not '.phpt' in filename:
360 return
362 print "Importing %s" % filename
364 def split(pattern, str):
365 return re.split(r'\n\s*--'+pattern+'--\s*\n', str, 1)
367 def parse_headers(zend):
368 sections = {}
369 cur_header = None
370 for line in zend.split('\n'):
371 header = re.match('--([_A-Z]+)--', line)
372 if header:
373 cur_header = header.group(1)
374 sections[cur_header] = []
375 else:
376 sections[cur_header].append(line)
377 return sections
379 sections = parse_headers(file(filename).read())
380 for i in sections.keys():
381 sections[i] = '\n'.join(sections[i])
383 unsupported_sections = ('INI', 'POST_RAW')
384 for name in unsupported_sections:
385 if sections.has_key(name):
386 print "Unsupported test with section --%s--: " % name, filename
387 return
389 if not sections.has_key('FILE'):
390 print "Malformed test, no --FILE--: ", filename
391 return
393 for key in ('EXPECT', 'EXPECTF', 'EXPECTREGEX'):
394 if sections.has_key(key):
395 exp = sections[key]
397 # tests are really inconsistent about whitespace
398 exp = re.sub(r'(\r\n|\r|\n)', '\n', exp.strip())
400 exp = exp.replace('in %s on', 'in %s/%s/%s on' %
401 ('hphp/test/zend/all', source_dir, dest_filename))
403 # PHP puts a newline in that we don't
404 exp = exp.replace('\n\nFatal error:', '\nFatal error:')
405 exp = exp.replace('\n\nWarning:', '\nWarning:')
406 exp = exp.replace('\n\nNotice:', '\nNotice:')
408 match_rest_of_line = '%a'
409 if key == 'EXPECTREGEX':
410 match_rest_of_line = '.+'
412 exp = re.sub(r'Fatal\\? error\\?:.*',
413 'HipHop Fatal error: '+match_rest_of_line, exp)
414 exp = re.sub(r'Warning\\?:.*',
415 'HipHop Warning: '+match_rest_of_line, exp)
416 exp = re.sub(r'Notice\\?:.*',
417 'HipHop Notice: '+match_rest_of_line, exp)
419 for error in errors:
420 exp = re.sub(error[0], error[1], exp)
422 sections[key] = exp
424 if sections.has_key('EXPECT'):
425 exp = sections['EXPECT']
426 # we use %a for error messages so always write expectf
427 file(full_dest_filename+'.expectf', 'w').write(exp)
428 elif sections.has_key('EXPECTREGEX'):
429 exp = sections['EXPECTREGEX']
430 file(full_dest_filename+'.expectregex', 'w').write(exp)
431 elif sections.has_key('EXPECTF'):
432 exp = sections['EXPECTF']
433 file(full_dest_filename+'.expectf', 'w').write(exp)
434 else:
435 print "Malformed test, no --EXPECT*--: ", filename
436 return
438 test = sections['FILE']
440 if sections.has_key('POST'):
441 test = test.replace(
442 '<?php',
443 '<?php\nparse_str("' + sections['POST'] + '", $_POST);\n'
445 if sections.has_key('GET'):
446 test = test.replace(
447 '<?php',
448 '<?php\nparse_str("' + sections['GET'] + '", $_GET);\n'
450 if sections.has_key('COOKIE'):
451 test = test.replace(
452 '<?php',
453 '<?php\n$_COOKIE = http_parse_cookie("' +
454 sections['COOKIE'] + '");\n'
456 if sections.has_key('ENV'):
457 for line in sections['ENV'].split('\n'):
458 boom = line.split('=')
459 if len(boom) == 2 and boom[0] and boom[1]:
460 test = test.replace(
461 '<?php',
462 '<?php\n$_ENV[%s] = %s;\n' % (boom[0], boom[1])
464 if sections.has_key('CLEAN'):
465 test += sections['CLEAN']
467 # If you put an exception in here, please send a pull request upstream to
468 # php-src. Then when it gets merged kill your hack.
469 if 'bug60771.php' in full_dest_filename:
470 test = test.replace("?>", "unlink('test.php');\n?>")
471 if 'bug44805.php' in full_dest_filename:
472 test = test.replace("1)) {\n\tunlink($file2", "2)) {\n\tunlink($file2")
473 if 'bug24054.php' in full_dest_filename:
474 test = test.replace("quicktester.inc", "tests/quicktester.inc")
475 if 'ext-bz2/with_strings.php' in full_dest_filename:
476 test = test.replace("../..", "")
477 if 'ext-bz2/bug51997.php' in full_dest_filename:
478 test = test.replace("testfile.bz2", "bug51997.bz2")
479 if 'ext-bz2/with_files.php' in full_dest_filename:
480 test = test.replace("testfile.bz2", "with_files.bz2")
481 if 'ext-xmlreader/003.php' in full_dest_filename:
482 test = test.replace("_002.xml", "_003.xml")
483 if 'ext-xmlreader/004.php' in full_dest_filename:
484 test = test.replace("_002.xml", "_004.xml")
485 if 'ext-standard-file/bug45181.php' in full_dest_filename:
486 test = test.replace('rmdir("bug45181_x");',
487 'chdir("..");\nrmdir("bug45181_x");')
488 if 'bug61139.php' in full_dest_filename:
489 test += "\nunlink('someFile');\n?>"
490 if '/ext-pdo_' in full_dest_filename:
491 test = test.replace('/../../../ext/pdo/tests/pdo_test.inc',
492 '/../ext-pdo/pdo_test.inc')
493 if '/ext-zlib/gzseek_variation7.php' in full_dest_filename:
494 test = test.replace('temp3.txt.gz', 'gzseek_variation7.gz')
495 if '/ext-zlib/gzseek_basic2.php' in full_dest_filename:
496 test = test.replace('temp3.txt.gz', 'gzseek_basic2.gz')
497 if '/ext-zlib/gzseek_variation1.php' in full_dest_filename:
498 test = test.replace('temp3.txt.gz', 'gzseek_variation1.gz')
499 if '/ext-zlib/gzseek_variation4.php' in full_dest_filename:
500 test = test.replace('temp3.txt.gz', 'gzseek_variation4.gz')
501 if '/ext-zlib/gzseek_variation5.php' in full_dest_filename:
502 test = test.replace('temp3.txt.gz', 'gzseek_variation5.gz')
503 if '/ext-standard-strings/vfprintf_' in full_dest_filename:
504 test = test.replace('dump.txt', dest_filename + '.txt')
505 if '/ext-standard-file/touch_basic.php' in full_dest_filename:
506 test = test.replace('touch.dat', 'touch_basic.dat')
507 if '/ext-standard-file/touch_variation2.php' in full_dest_filename:
508 test = test.replace('touch.dat', 'touch_variation2.dat')
509 if '/ext-standard-file/file_put_contents_variation9.php' in full_dest_filename:
510 test = test.replace('fileGetContentsVar9', 'filePutContentsVar9')
511 if '/ext-standard-network/tcp4loop.php' in full_dest_filename:
512 test = test.replace('31337', '31338')
513 if '/ext-standard-file/fpassthru_variation.php' in full_dest_filename:
514 test = test.replace('passthru.tmp', 'fpassthru_variation.tmp')
516 file(full_dest_filename, 'w').write(test)
518 if args.zend_path:
519 test_dirs = (('Zend/tests'), ('tests'), ('sapi'), ('ext'))
520 def should_import(filename):
521 for bad in no_import:
522 if bad in filename:
523 return False
524 return True
526 for source in test_dirs:
527 for root, dirs, files in os.walk(os.path.join(args.zend_path, source)):
528 for filename in files:
529 full_file = os.path.join(root, filename)
531 def matches(regexes):
532 if not regexes:
533 return True
534 for regex in regexes:
535 if re.search(regex, full_file):
536 return True
537 return False
539 if matches(args.only) and should_import(full_file):
540 walk(full_file, root.replace(args.zend_path, ''))
542 if not os.path.isdir('test/zend/all'):
543 if args.zend_path:
544 print "No test/zend/all. Maybe no tests were imported?"
545 sys.exit(0)
546 else:
547 print "Running all tests from test/zend/bad"
548 shutil.copytree('test/zend/bad', 'test/zend/all')
549 else:
550 print "Running all tests from zend/all"
552 file('test/zend/hphp_config.hdf', 'w').write('')
553 file('test/zend/config.hdf', 'w').write(
554 'Eval {\n EnableObjDestructCall = true\n }'
557 stdout = subprocess.Popen(
559 'tools/verify_to_json.php',
560 'test/run',
561 'test/zend/all',
562 'interp',
564 '../_bin',
566 stdout=subprocess.PIPE,
567 stderr=subprocess.STDOUT
568 ).communicate()[0]
570 # segfaults also print on stderr
571 stdout = re.sub('\nsh: line 1:.*', '', stdout)
572 # fbmake, you are crazy
573 results = json.loads('['+stdout.strip().replace("\n", ",\n")+']')[-1]['results']
575 if args.verbose:
576 print results
578 for test in results:
579 filename = test['name']
580 good_file = filename.replace('all', 'good', 1)
581 bad_file = filename.replace('all', 'bad', 1)
582 mkdir_p(os.path.dirname(good_file))
583 mkdir_p(os.path.dirname(bad_file))
585 good = (test['status'] == 'passed')
586 for test in bad_tests:
587 if test in filename:
588 good = False
590 if good:
591 dest_file = good_file
592 delete_file = bad_file
593 subpath = 'good'
594 else:
595 dest_file = bad_file
596 delete_file = good_file
597 subpath = 'bad'
599 exps = glob.glob(filename+'.expect*')
600 if not exps:
601 # this file is probably generated while running tests :(
602 continue
604 source_file_exp = exps[0]
605 _, dest_ext = os.path.splitext(source_file_exp)
606 os.rename(filename, dest_file)
607 file(dest_file+dest_ext, 'w').write(
608 file(source_file_exp).read().replace('/all', '/' + subpath)
610 os.unlink(source_file_exp)
611 for f in glob.glob(delete_file+"*"):
612 os.unlink(f)
614 # extra random files needed for tests...
615 for root, dirs, files in os.walk('test/zend/all'):
616 for filename in files:
617 filename = os.path.join(root, filename)
619 for name in other_files:
620 if name in filename:
621 dest = filename.replace('all', 'good', 1)
622 dir = os.path.dirname(dest)
623 mkdir_p(dir)
624 shutil.copyfile(filename, dest)
626 if not args.dirty:
627 shutil.rmtree('test/zend/all')