@@ -29,6 +29,10 @@ def _impl(ctx):
2929 for k , v in ctx .attr .test_env .items ():
3030 test_env_commands .append ("export {}=\" {}\" " .format (k , v ))
3131
32+ ct_hooks_args = ""
33+ if len (ctx .attr .ct_hooks ) > 0 :
34+ ct_hooks_args = "-ct_hooks " + " " .join (ctx .attr .ct_hooks )
35+
3236 sname = sanitize_sname ("ct-{}-{}" .format (
3337 ctx .label .package .rpartition ("/" )[- 1 ],
3438 ctx .label .name ,
8589 ${{FILTER}} \\
8690 -dir $TEST_SRCDIR/$TEST_WORKSPACE/{dir} \\
8791 -logdir ${{TEST_UNDECLARED_OUTPUTS_DIR}} \\
92+ {ct_hooks_args} \\
8893 -sname {sname}
8994""" .format (
9095 begins_with_fun = BEGINS_WITH_FUN ,
@@ -98,6 +103,7 @@ set -x
98103 sharding_method = ctx .attr .sharding_method ,
99104 suite_name = ctx .attr .suite_name ,
100105 dir = short_dirname (ctx .files .compiled_suites [0 ]),
106+ ct_hooks_args = ct_hooks_args ,
101107 sname = sname ,
102108 test_env = " && " .join (test_env_commands ),
103109 )
@@ -133,6 +139,7 @@ ct_sharded_test = rule(
133139 allow_files = [".beam" ],
134140 mandatory = True ,
135141 ),
142+ "ct_hooks" : attr .string_list (),
136143 "data" : attr .label_list (allow_files = True ),
137144 "deps" : attr .label_list (providers = [ErlangLibInfo ]),
138145 "tools" : attr .label_list (),
0 commit comments