Skip to content

Commit 4c7ab32

Browse files
committed
Add a ct_run_extra_args attr to the ct_test rule
This can be useful for instance, to enable runtime features such as the maybe syntax
1 parent b558be2 commit 4c7ab32

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

private/ct.bzl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ def _impl(ctx):
7070

7171
ct_logdir = ctx.attr._ct_logdir[BuildSettingInfo].value
7272

73-
ct_hooks_args = ""
73+
extra_args = []
7474
if len(ctx.attr.ct_hooks) > 0:
75-
ct_hooks_args = "-ct_hooks " + " ".join(ctx.attr.ct_hooks)
75+
extra_args.append("-ct_hooks " + " ".join(ctx.attr.ct_hooks))
76+
extra_args.extend(ctx.attr.ct_run_extra_args)
7677

7778
(erlang_home, _, runfiles) = erlang_dirs(ctx)
7879

@@ -143,8 +144,7 @@ set -x
143144
-dir test {pa_args} \\
144145
-logdir "{log_dir}" \\
145146
-hidden \\
146-
{ct_hooks_args} \\
147-
-sname {sname}
147+
-sname {sname} {extra_args}
148148
""".format(
149149
maybe_install_erlang = maybe_install_erlang(ctx, short_path = True),
150150
erlang_home = erlang_home,
@@ -156,8 +156,8 @@ set -x
156156
pa_args = " ".join(pa_args),
157157
dir = path_join(package, "test"),
158158
log_dir = log_dir,
159-
ct_hooks_args = ct_hooks_args,
160159
sname = sname(ctx),
160+
extra_args = " ".join(extra_args),
161161
test_env = "\n".join(test_env_commands),
162162
)
163163
else:
@@ -221,8 +221,7 @@ echo on
221221
-dir test {pa_args} ^
222222
-logdir {drive_letter}: ^
223223
-hidden ^
224-
{ct_hooks_args} ^
225-
-sname {sname}
224+
-sname {sname} {extra_args}
226225
set CT_RUN_ERRORLEVEL=%ERRORLEVEL%
227226
subst {drive_letter}: /d
228227
exit /b %CT_RUN_ERRORLEVEL%
@@ -238,8 +237,8 @@ exit /b %CT_RUN_ERRORLEVEL%
238237
dir = path_join(package, "test"),
239238
log_dir = log_dir,
240239
drive_letter = ctx.attr._windows_logdir_drive_letter,
241-
ct_hooks_args = ct_hooks_args,
242240
sname = sname(ctx),
241+
extra_args = " ".join(extra_args),
243242
test_env = "\n".join(test_env_commands),
244243
)
245244

@@ -284,6 +283,7 @@ ct_test = rule(
284283
mandatory = True,
285284
),
286285
"ct_hooks": attr.string_list(),
286+
"ct_run_extra_args": attr.string_list(),
287287
"data": attr.label_list(allow_files = True),
288288
"deps": attr.label_list(providers = [ErlangAppInfo]),
289289
"tools": attr.label_list(cfg = "target"),

0 commit comments

Comments
 (0)