Skip to content

Commit b38f52e

Browse files
committed
fix: update component_validation_test to handle multiple output files
The component_validation_test rule was failing because cpp_component targets with validate_wit=True produce both .wasm files and validation log files. The test rule was expecting a single file but receiving multiple files. Changes: - Updated _component_validation_test_impl to extract just the .wasm file from targets that produce multiple outputs - Removed allow_single_file restriction from component attribute - Added proper error handling for missing .wasm files Fixes C++ component validation test failures: - //test/cpp:test_calculator_c_component_valid_wasm - //test/cpp:test_calculator_cpp_component_valid_wasm - //test/cpp:test_http_service_component_valid_wasm
1 parent cc8e01d commit b38f52e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/integration/integration_tests.bzl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@
33
def _component_validation_test_impl(ctx):
44
"""Implementation for component validation test."""
55

6-
component_file = ctx.file.component
6+
# Handle components that produce multiple files (e.g., validation outputs)
7+
# Extract just the .wasm file from the component target
8+
component_files = ctx.attr.component[DefaultInfo].files.to_list()
9+
component_file = None
10+
for file in component_files:
11+
if file.extension == "wasm":
12+
component_file = file
13+
break
14+
15+
if not component_file:
16+
fail("Component target must produce a .wasm file")
717
test_script = ctx.actions.declare_file(ctx.label.name + "_test.sh")
818

919
# Create test script content
@@ -98,7 +108,6 @@ component_validation_test = rule(
98108
test = True,
99109
attrs = {
100110
"component": attr.label(
101-
allow_single_file = [".wasm"],
102111
mandatory = True,
103112
doc = "The WASM component to validate",
104113
),

0 commit comments

Comments
 (0)