Skip to content

Commit

Permalink
checking the output of builds and adding test all
Browse files Browse the repository at this point in the history
  • Loading branch information
goddenrich committed Oct 26, 2023
1 parent 88c6000 commit 67a1cb4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/build_defs/test.build_defs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def please_repo_e2e_test(
test_cmd += [f'_STR="$(cat {o})" _SUBSTR="{c}" && if [ "${_STR##*$_SUBSTR*}" ]; then echo "$_STR"; exit 1; fi' for o, c in expect_output_contains.items()]

if expect_output_doesnt_contain:
test_cmd += [f'_STR="$(cat {o})" _SUBSTR="{c}" && if [ -z "${_STR##*$_SUBSTR*}" ]; then echo "$_STR"; exit 1; fi' for o, c in expect_output_contains.items()]
test_cmd += [f'_STR="$(cat {o})" _SUBSTR="{c}" && if [ -z "${_STR##*$_SUBSTR*}" ]; then echo "$_STR"; exit 1; fi' for o, c in expect_output_doesnt_contain.items()]

test_cmd = ' && '.join(test_cmd)

Expand Down
20 changes: 19 additions & 1 deletion test/keep_going/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
subinclude("//test/build_defs")

please_repo_e2e_test(
name = "build_all",
name = "plz_build_all",
expected_failure = True,
expected_output = {
"plz-out/gen/package/pass": "",
"plz-out/gen/package/dep_pass": "",
"plz-out/gen/package/fail_test_pass_dep": "",
},
plz_command = "plz build --keep_going //package:all",
repo = "test_repo",
)

please_repo_e2e_test(
name = "plz_test_all",
expect_output_contains = {
"plz-out/log/test_results.xml": "fail_test_pass_dep",
},
expect_output_doesnt_contain = {
"plz-out/log/test_results.xml": "fail_test_fail_dep",
},
expected_failure = True,
plz_command = "plz test --keep_going //package:all",
repo = "test_repo",
)

14 changes: 12 additions & 2 deletions test/keep_going/test_repo/package/BUILD_FILE
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ build_rule(

build_rule(
test = True,
name = "fail_test",
name = "fail_test_pass_dep",
cmd = "touch $OUTS",
test_cmd = "exit 1",
outs = ["fail_test"],
outs = ["fail_test_pass_dep"],
deps = [":pass"],
)

build_rule(
test = True,
name = "pass_test_fail_dep",
cmd = "touch $OUTS",
test_cmd = "exit 0",
outs = ["pass_test_fail_deps"],
deps = [":fail"],
)

0 comments on commit 67a1cb4

Please sign in to comment.