Skip to content

Commit 3772262

Browse files
nlopezgirbe-toolchains-pr-bot
authored andcommitted
fix repro tests (#1379)
1 parent 9d6528c commit 3772262

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

contrib/repro_test.bzl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,14 @@ def _impl(ctx):
168168
# Commands to build the image targets and copy files.
169169
commands_image1 = cd_cmd + [
170170
("bazel --output_base=%s build " % host_outs_path1) + " ".join(build_targets),
171-
] + cp_cmds + ["rm -rf %s" % host_outs_path1]
171+
] + cp_cmds
172172

173173
# Some deb package installations (e.g. openjdk-8-jdk) use timestamps
174174
# during installation. Avoid bulding and reproducing a container at the
175175
# same start time by sleeping 10 secs before rebuilding.
176176
commands_image2 = ["sleep 10"] + cd_cmd + [
177177
("bazel --output_base=%s build " % host_outs_path2) + " ".join(build_targets),
178-
] + cp_cmds + ["rm -rf %s" % host_outs_path2]
178+
] + cp_cmds
179179

180180
# Mount the docker.sock inside the running container to enable docker
181181
# sibling, which is needed when builing the test image itself requires
@@ -217,6 +217,14 @@ def _impl(ctx):
217217
script_file = ctx.actions.declare_file(name + ".build2"),
218218
)
219219

220+
# Delete intermediate outputs
221+
delete_out = ctx.actions.declare_file(name + "_delete_out")
222+
ctx.actions.run_shell(
223+
inputs = [bazel_out1, bazel_out2, img1_outs, img2_outs],
224+
outputs = [delete_out],
225+
command = " rm -rf %s && rm -rf %s | tee %s" % (host_outs_path1, host_outs_path2, delete_out.path),
226+
)
227+
220228
# Expand template to run the image comparison test.
221229
type_args = ["--type=" + type_arg for type_arg in ctx.attr.container_diff_args]
222230
diff_tool_exec = ctx.executable._container_diff_tool
@@ -241,6 +249,7 @@ def _impl(ctx):
241249
files = [
242250
bazel_out1,
243251
bazel_out2,
252+
delete_out,
244253
diff_tool_exec,
245254
img1_outs,
246255
img2_outs,

0 commit comments

Comments
 (0)