Don't use Aast.Any when marking expressions as type Tany
[hiphop-php.git] / hphp / test / DEFS.bzl
blobb7ef4d1b3412802f4dc3aac230045c4ab1be8009
1 # -*- mode: python -*-
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,
10                     retranslate_all=0,
11                     jit_serialize=0,
12                     cli_server=0,
13                     hhas_roundtrip=False, target_suffix='',
14                     extra_args=[], blacklist=None,
15                     noop_rule=False):
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
19   # sets for CI runs.
20   if repo and native.read_config('hhvm', 'skip_repo_test'):
21     noop_rule = True
23   if not repo and native.read_config('hhvm', 'skip_non_repo_test'):
24     noop_rule = True
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 '') + \
34        target_suffix
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'
42   command = [
43     '/usr/local/hphpi/bin/hhvm',
44     '$(location //hphp/test:run.php)',
45     suite,
46     '-m',
47     mode,
48   ] + extra_args + (
49     [ '-a', '-vEval.HHIRGenerateAsserts=true' ] if generate_hhir_asserts else
50     []
51   )
52   if repo:
53     command.extend(['-r',
54                     '--repo-threads', '5'])
55   if relocate != 0:
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])
63   if recycle_tc != 0:
64     command.extend(['--recycle-tc', '%d' % recycle_tc,
65                     '--exclude-pattern', '=/debugger|ext_vsdebug/='])
66   if hhas_roundtrip:
67     command.extend(['--hhas-round-trip',
68                     '--exclude-pattern', '=/debugger|ext_vsdebug/='])
70   if cli_server != 0:
71     command.append('--cli-server')
73   deplist=[
74     '//hphp/hhvm:hhvm',
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:
77     #
78     # 1) Our test targets need to be within 6 dependency hops of all of our
79     #    source files (see https://fburl.com/3dpob2w2).
80     #
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
84     #    build them.
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,
90   ]
92   if blacklist != None:
93       command.extend(['-x', blacklist])
94       head = paths.dirname(blacklist)
95       tail = paths.basename(blacklist)
96       deplist.append('//' + head + ':' + tail)
98   if noop_rule:
99     custom_unittest(
100       name=target_name,
101       command=['true'],
102       deps=deplist,
103       type='simple',
104     )
105   else:
106     custom_unittest(
107       name=target_name,
108       command=command,
109       deps=deplist,
110       tags=['hphp-test'] + (['run_as_bundle'] if cli_server != 0 else []),
111     )