From baf2042d5b17497f2eab914686f746541be6430d Mon Sep 17 00:00:00 2001 From: Andrea Campi Date: Fri, 31 Jan 2025 05:02:24 -0800 Subject: [PATCH] Fix with_stripped_logs to propagate the exit code Summary: We have been using with_stripped_logs more to clean up the output of tests. Unfortunately it strips the exit code, which can make debugging harder on failure. Annoingly, it also makes it hard to add to existing tests. Fix the issue. Reviewed By: clara-9 Differential Revision: D68948386 fbshipit-source-id: 701a34f2827e4e69e03729f1be431cce5dfcf3e6 --- .../integration/cross_repo/test-cross-repo-commit-sync-regex.t | 3 ++- eden/mononoke/tests/integration/library.sh | 2 ++ eden/mononoke/tests/integration/test-library-unit-tests.t | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/eden/mononoke/tests/integration/cross_repo/test-cross-repo-commit-sync-regex.t b/eden/mononoke/tests/integration/cross_repo/test-cross-repo-commit-sync-regex.t index fa31eccac8378..a054ccb2112b5 100644 --- a/eden/mononoke/tests/integration/cross_repo/test-cross-repo-commit-sync-regex.t +++ b/eden/mononoke/tests/integration/cross_repo/test-cross-repo-commit-sync-regex.t @@ -67,7 +67,7 @@ inconsistent value of *, but 'meg-mon' bookmark points to None (glob) inconsistent value of *, but 'meg-mon' bookmark points to None (glob) Error: found 2 inconsistencies - + [1] -- use verify-bookmarks, but passing a regex. $ with_stripped_logs crossrepo_verify_bookmarks 2 0 --update-large-repo-bookmarks \ @@ -80,6 +80,7 @@ > --no-bookmark-updates found 2 inconsistencies, trying to update them... Error: Missing outcome for * from small repo (glob) + [1] -- sync the missing commits $ with_stripped_logs mononoke_x_repo_sync 2 0 once --bookmark-regex ".+bookmark" diff --git a/eden/mononoke/tests/integration/library.sh b/eden/mononoke/tests/integration/library.sh index b0e43a29f8e58..d27d97bffc9ac 100755 --- a/eden/mononoke/tests/integration/library.sh +++ b/eden/mononoke/tests/integration/library.sh @@ -405,6 +405,8 @@ function strip_glog { function with_stripped_logs { "$@" 2>&1 | strip_glog + # propagate the exit status, otherwise the test will happily continue on failure + return "${PIPESTATUS[0]}" } function wait_for_json_record_count { diff --git a/eden/mononoke/tests/integration/test-library-unit-tests.t b/eden/mononoke/tests/integration/test-library-unit-tests.t index 87498ad9880c1..54a18c7718988 100644 --- a/eden/mononoke/tests/integration/test-library-unit-tests.t +++ b/eden/mononoke/tests/integration/test-library-unit-tests.t @@ -71,12 +71,13 @@ plain output -# with_stripped_logs doesn't propagate the exit code correctly +# with_stripped_logs *will* propagate the exit code correctly $ with_stripped_logs mononoke_admin invalid error: unrecognized subcommand 'invalid' Usage: admin [OPTIONS] <--config-path |--config-tier |--prod|--git-config> For more information, try '--help'. + [2]