From 73663a2512a563a55ce2f71d034788f75476d82b Mon Sep 17 00:00:00 2001 From: ptarjan Date: Sun, 7 Apr 2013 22:01:48 -0700 Subject: [PATCH] Allow script to be run without -z option I switched to using a temporary directory for the test run, but never wrote a way to use the existing bad tests. Now it just copies the bad tests to ##all## and runs them there. Should I rename this script? ##tools/zend_tests.py## or something? --- hphp/tools/import_zend_test.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/hphp/tools/import_zend_test.py b/hphp/tools/import_zend_test.py index 90c95c7ce..2f925ecb3 100644 --- a/hphp/tools/import_zend_test.py +++ b/hphp/tools/import_zend_test.py @@ -9,6 +9,7 @@ import argparse import os import re import subprocess +import shutil import sys bad_tests = ( @@ -336,13 +337,25 @@ if args.zend_path: walk(full_file, root.replace(args.zend_path, '')) if not os.path.isdir('test/zend/all'): - print "No test/zend/all. Maybe no tests were imported?" - sys.exit(0) + if args.zend_path: + print "No test/zend/all. Maybe no tests were imported?" + sys.exit(0) + else: + print "Running all tests from test/zend/bad" + shutil.copytree('test/zend/bad', 'test/zend/all') if not args.dont_run: env = os.environ env.update({'VQ':'interp', 'TEST_PATH':'zend/all'}) - proc = subprocess.Popen(['tools/run_verify.sh'], env=env) + stdout = open(os.devnull, 'wb') + if args.verbose: + stdout = None + proc = subprocess.Popen( + ['tools/run_verify.sh'], + env=env, + stdout=stdout, + stderr=subprocess.STDOUT + ) proc.wait() for root, dirs, files in os.walk('test/zend/all'): @@ -425,5 +438,4 @@ for root, dirs, files in os.walk('test/zend/all'): os.unlink(delete_file+'.exp') if not args.dirty: - import shutil shutil.rmtree('test/zend/all')