From e35c2971c28bb8f026f9fe0197d1687cda2a4b3a Mon Sep 17 00:00:00 2001 From: ptarjan Date: Thu, 11 Apr 2013 16:36:34 -0700 Subject: [PATCH] start running TCR tests with verify I went a bit crazy and supported all the quick and zend tests in the same format. Or do you think we should normalize the other way? Or are there better names? I think if you like this, I should move the "vm" directory to "quick" and the TectCodeRun to "slow" directory or something so we put tests into nicer suites. --- hphp/tools/import_zend_test.py | 3 +- hphp/tools/run_test.py | 79 ++++++++++++++++++++++++++++++++++ hphp/tools/verify_to_json.php | 7 +-- 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100755 hphp/tools/run_test.py diff --git a/hphp/tools/import_zend_test.py b/hphp/tools/import_zend_test.py index 6250d31b7..dbf896ebd 100644 --- a/hphp/tools/import_zend_test.py +++ b/hphp/tools/import_zend_test.py @@ -303,8 +303,9 @@ stdout = subprocess.Popen( [ 'tools/verify_to_json.php', 'run_verify.sh', - 'interp', 'test/zend/all', + 'interp', + '0', '_bin', ], stdout=subprocess.PIPE, diff --git a/hphp/tools/run_test.py b/hphp/tools/run_test.py new file mode 100755 index 000000000..ebd076551 --- /dev/null +++ b/hphp/tools/run_test.py @@ -0,0 +1,79 @@ +#!/bin/env python +# +# Helper for running hphp/test in fbconfig builds. +# +# ./run_test.py TestCodeRunVM +# ./run_test.py QuickRepoJit +# ./run_test.py ZendJitIR +# +# Components are: +# +# SuiteName [VM|Jit|JitIR] [|Repo] [-SubSuiteName] +# + +import re +import os +import subprocess +import sys + +suites = { + 'TestCodeRun' : 'tcr', + 'Quick' : 'vm', + 'Zend' : 'zend/good', +} +modes = { + 'JitIR' : 'hhir', + 'Jit' : 'jit', + 'VM' : 'inperp', +} + +home = os.getenv('HPHP_HOME') +root = os.getenv('FBMAKE_BIN_ROOT', home + '/_bin') + +def main(): + if len(sys.argv) < 2: + print "%s [TestCodeRun|Quick|Zend][|Repo][VM|Jit|JitIR][-SubSuiteName]" % sys.argv[0] + return + + arg = sys.argv[1] + for suite, dir in suites.items(): + if arg.startswith(suite): + arg = arg.replace(suite, '') + + repo = '' + if arg.startswith('Repo'): + arg = arg.replace('Repo', '') + repo = '1' + + for mode, vq in modes.items(): + if arg.startswith(mode): + arg = arg.replace(mode, '') + + subpath = '' + if len(arg): + if arg[0] == '-': + subpath = '/' + camel_to_slash(arg[1:]) + else: + raise Exception('Extra? "%s"' % arg) + + env = { + 'REPO' : repo, + 'VQ' : vq, + 'TEST_PATH' : 'test/' + dir + subpath + } + print ' '.join([key + '=' + value for key, value in env.items()]) + 'tools/run_verify.sh' + env.update(os.environ) + subprocess.call('tools/run_verify.sh', env=env) + return + + raise Exception('Unknown mode "%s"' % arg) + + os.chdir(home + '/hphp') + cmd = sys.argv + cmd[0] = root + '/hphp/test/test' + subprocess.call(cmd) + +def camel_to_slash(name): + s1 = re.sub('(.)([A-Z][a-z]+)', r'\1/\2', name) + return re.sub('([a-z0-9])([A-Z])', r'\1/\2', s1).lower() +main() diff --git a/hphp/tools/verify_to_json.php b/hphp/tools/verify_to_json.php index 0f27f7db8..159e89c3c 100755 --- a/hphp/tools/verify_to_json.php +++ b/hphp/tools/verify_to_json.php @@ -6,12 +6,13 @@ include_once $HPHP_HOME.'/hphp/test/fbmake_test_lib.php'; ////////////////////////////////////////////////////////////////////// -if (count($argv) != 5) { - echo "usage: $argv[0] test-script interp|jit|hhir TEST_PATH FBMAKE_BIN_ROOT\n"; +if (count($argv) != 6) { + echo "usage: $argv[0] test-script TEST_PATH interp|jit|hhir REPO_BOOLEAN FBMAKE_BIN_ROOT + FBMAKE_BIN_ROOT\n"; exit(1); } -$cmd = "VQ=$argv[2] TEST_PATH=$argv[3] FBMAKE_BIN_ROOT=$HPHP_HOME/$argv[4] " . +$cmd = "TEST_PATH=$argv[2] VQ=$argv[3] REPO=$argv[4] FBMAKE_BIN_ROOT=$HPHP_HOME/$argv[5] " . "$HPHP_HOME/hphp/tools/$argv[1]"; loop_tests($cmd, function ($line) {