3 load("@bazel_skylib//lib:paths.bzl", "paths")
4 load("@fbcode_macros//build_defs:compiler.bzl", "compiler")
6 include_defs("//hphp/DEFS.bzl")
8 def verify_unittest(suite, repo, dir, mode='interp,jit',
9 relocate=0, recycle_tc=0,
13 hhas_roundtrip=False, target_suffix='',
14 extra_args=[], blacklist=None,
17 # hphp_skip_repo_test and hphp_skip_non_repo_test let us enable or disable
18 # tests based on repo mode. This is useful to shard our tests into different
20 if repo and native.read_config('hhvm', 'skip_repo_test'):
23 if not repo and native.read_config('hhvm', 'skip_non_repo_test'):
26 target_name = 'verify_' + suite + '_' + mode + \
27 ('_repo' if repo else '') + \
28 ('_relocate' if relocate else '') + \
29 ('_retranslate-all' if retranslate_all else '') + \
30 ('_jit-serialize' if jit_serialize else '') + \
31 ('_recycle-tc' if recycle_tc else '') + \
32 ('_cli-server' if cli_server else '') + \
33 ('_hhas_roundtrip' if hhas_roundtrip else '') + \
36 target_name = target_name.replace('/', '_')
37 target_name = target_name.replace(',', '_')
39 generate_hhir_asserts = not is_opt_hhvm_build() and \
40 compiler.get_compiler_for_current_buildfile() == 'clang'
43 '/usr/local/hphpi/bin/hhvm',
44 '$(location //hphp/test:run.php)',
49 [ '-a', '-vEval.HHIRGenerateAsserts=true' ] if generate_hhir_asserts else
54 '--repo-threads', '5'])
56 command.extend(['--relocate', '%d' % relocate,
57 '--exclude-pattern', '=/debugger|ext_vsdebug/='])
58 if retranslate_all != 0:
59 command.extend(['--retranslate-all', '%d' % retranslate_all,
60 '--exclude-pattern', '=/debugger|ext_vsdebug/='])
61 if jit_serialize != 0:
62 command.extend(['--jit-serialize', '%d' % jit_serialize])
64 command.extend(['--recycle-tc', '%d' % recycle_tc,
65 '--exclude-pattern', '=/debugger|ext_vsdebug/='])
67 command.extend(['--hhas-round-trip',
68 '--exclude-pattern', '=/debugger|ext_vsdebug/='])
71 command.append('--cli-server')
75 # This dependency on hhvm_link shouldn't be necessary, since hhvm already
76 # depends (indirectly) on hhvm_link. But we have it here for two reasons:
78 # 1) Our test targets need to be within 6 dependency hops of all of our
79 # source files (see https://fburl.com/3dpob2w2).
81 # 2) In a dev build, when Buck gets the hhvm binary from cache, it doesn't
82 # build all the necessary .so files (this is an issue with hhvm:hhvm
83 # being a custom_rule). A direct dependency on hhvm_link forces Buck to
85 '//hphp/hhvm:hhvm_link',
86 '//hphp/hhvm:symlinks',
87 '//hphp/runtime:runtime_core',
88 '//hphp/facebook/extensions:facebook_extensions',
89 ('' if dir.startswith('//') else '//hphp/test:') + dir,
93 command.extend(['-x', blacklist])
94 head = paths.dirname(blacklist)
95 tail = paths.basename(blacklist)
96 deplist.append('//' + head + ':' + tail)
110 tags=['hphp-test'] + (['run_as_bundle'] if cli_server != 0 else []),