From 0bc75cd589a347820b89e8f95873c8aae762c84e Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sat, 21 Mar 2026 16:04:40 +0000 Subject: [PATCH] Fix test validation and coverage HTML generation - Fix false positive "missing tests" errors when processing secondary workdirs (e.g., deprecate_eof_support). The validation now only checks tests that actually exist in the current workdir rather than all tests in groups.json for the TAP_GROUP. - Add --ignore-errors negative,source --synthesize-missing flags to genhtml calls in run-tests-isolated.bash to match the multi-group runner and prevent HTML generation failures on coverage data with negative branch counts. --- test/infra/control/run-tests-isolated.bash | 4 +-- test/scripts/bin/proxysql-tester.py | 36 +++++++++++++--------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/test/infra/control/run-tests-isolated.bash b/test/infra/control/run-tests-isolated.bash index d2098e21c..438510e67 100755 --- a/test/infra/control/run-tests-isolated.bash +++ b/test/infra/control/run-tests-isolated.bash @@ -165,7 +165,7 @@ docker run \ if command -v genhtml >/dev/null 2>&1; then local html_dir=\"\${COVERAGE_REPORT_DIR}/html\" mkdir -p \"\${html_dir}\" - genhtml --branch-coverage \"\${coverage_file}\" --output-directory \"\${html_dir}\" 2>&1 || echo \">>> WARNING: HTML generation failed\" + genhtml --branch-coverage --ignore-errors negative,source --synthesize-missing \"\${coverage_file}\" --output-directory \"\${html_dir}\" 2>&1 || echo \">>> WARNING: HTML generation failed\" [ -f \"\${html_dir}/index.html\" ] && echo \">>> HTML coverage report: \${html_dir}/index.html\" fi else @@ -278,7 +278,7 @@ if [ "${COVERAGE_MODE}" = "1" ]; then if command -v genhtml >/dev/null 2>&1; then HTML_REPORT_DIR="${COVERAGE_REPORT_DIR}/html/${TAP_GROUP:-test}-${INFRA_ID}" mkdir -p "${HTML_REPORT_DIR}" - genhtml --branch-coverage "${COVERAGE_INFO_FILE}" --output-directory "${HTML_REPORT_DIR}" 2>/dev/null || \ + genhtml --branch-coverage --ignore-errors negative,source --synthesize-missing "${COVERAGE_INFO_FILE}" --output-directory "${HTML_REPORT_DIR}" 2>/dev/null || \ echo ">>> WARNING: HTML report generation failed" [ -d "${HTML_REPORT_DIR}" ] && echo ">>> HTML report: ${HTML_REPORT_DIR}/index.html" fi diff --git a/test/scripts/bin/proxysql-tester.py b/test/scripts/bin/proxysql-tester.py index bbd309425..120333943 100755 --- a/test/scripts/bin/proxysql-tester.py +++ b/test/scripts/bin/proxysql-tester.py @@ -924,21 +924,29 @@ CREATE TABLE stats_history.mysql_server_read_only_log ( # Validate that all expected tests for this group passed # If TAP_GROUP is set and group_has_tests, we expect ALL tests in groups.json to pass + # NOTE: Only validate tests that actually exist in the current workdir to avoid + # false positives when processing secondary workdirs (e.g., deprecate_eof_support) if TAP_GROUP and group_has_tests and groups: - expected_tests = set(test_name for test_name, test_groups in groups.items() if TAP_GROUP in test_groups) - passed_tests = set(os.path.basename(cmd) for cmd, rc_val in summary if rc_val == 0) - failed_tests = set(os.path.basename(cmd) for cmd, rc_val in summary if rc_val is not None and rc_val != 0) - missing_tests = expected_tests - passed_tests - failed_tests - - if missing_tests: - log.critical(f"TAP_GROUP '{TAP_GROUP}': {len(missing_tests)} expected tests did not run: {sorted(missing_tests)}") - rc = rc + len(missing_tests) - - if len(passed_tests) != len(expected_tests): - log.critical(f"TAP_GROUP '{TAP_GROUP}': Expected {len(expected_tests)} tests to pass, but only {len(passed_tests)} passed. Failed: {len(failed_tests)}, Missing: {len(missing_tests)}") - # Ensure rc is non-zero to indicate failure - if rc == 0: - rc = len(expected_tests) - len(passed_tests) + # Get tests that exist in the current workdir and belong to TAP_GROUP + available_tests = set(os.path.basename(t) for t in tap_tests) + expected_in_workdir = set(test_name for test_name, test_groups in groups.items() + if TAP_GROUP in test_groups and test_name in available_tests) + + # Only validate if this workdir has tests for our group + if expected_in_workdir: + passed_tests = set(os.path.basename(cmd) for cmd, rc_val in summary if rc_val == 0) + failed_tests = set(os.path.basename(cmd) for cmd, rc_val in summary if rc_val is not None and rc_val != 0) + missing_tests = expected_in_workdir - passed_tests - failed_tests + + if missing_tests: + log.critical(f"TAP_GROUP '{TAP_GROUP}': {len(missing_tests)} expected tests did not run: {sorted(missing_tests)}") + rc = rc + len(missing_tests) + + if len(passed_tests) != len(expected_in_workdir): + log.critical(f"TAP_GROUP '{TAP_GROUP}': Expected {len(expected_in_workdir)} tests to pass, but only {len(passed_tests)} passed. Failed: {len(failed_tests)}, Missing: {len(missing_tests)}") + # Ensure rc is non-zero to indicate failure + if rc == 0: + rc = len(expected_in_workdir) - len(passed_tests) return rc, logs, summary