Skip to content

Commit

Permalink
JSON-based test reports
Browse files Browse the repository at this point in the history
Summary:
Adding a script for post-processing test results and generating JSON-based result files.
Report format example:

  {
    "total_errors": 0,
    "total_skipped": 296,
    "total_failures": 1,
    "total_test_instances": 4086,
    "total_tests_run": 4062,
    "build_root": "build/asan-clang-dynamic-enterprise-ninja",
    "aggregation_errors": [],
    "compiler_type": "clang",
    "build_type": "asan",
    "tests": [
      {
        "language": "java",
        "class_name": "org.yb.cql.TestSelect",
        "junit_xml_path": "java/yb-cql/target/...",
        "time": 12.804,
        "log_path": "java/yb-cql/target/...",
        "test_name": "testQualifiedColumnReference"
      },
      ...
    ]
  }

In these reports we can capture more information, such as paths to multiple types of per-test log files,
than we could in JUnit-compatible XML test result files. Also we now correctly count skipped C++ tests,
which are reported in a different way by the gtest framework (using `"status": "notrun"`) compared to
the way skipped tests are reported in Java.

Other test framework improvements:
- Re-run Java tests with "Address already in use" and a couple more test patterns in the log (at most once). We already do this for C++ tests.
- Adding an `YB_DEBUG_VIRTUALENV` environment variable for debugging virtualenv-related behavior.
- Simplifying the logic for picking TEST_TMPDIR. Now it is always in `/tmp`.
- Removing the old code for symbolizing C++ stack traces in the log which we don't use anyway, and which does not work for external mini-cluster tests.
- Add a timeout in `update_test_result_xml.py`, because that script used to get stuck for hours in some cases on macOS.
- Pick bind IPs on macOS in Java tests based on the actual list of available loopback interfaces, not assuming a specific range of pre-created interfaces.

YSQL-specific test improvements:
- Create a new flag `pg_yb_session_timeout_ms` and set it to 120 seconds by default on macOS (60 seconds otherwise).

Refactoring:
- Renaming test framework functions specific to C++ so that their name clearly states that.

Test Plan: Jenkins

Reviewers: bogdan, sergei, timur, bharat

Reviewed By: bharat

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D6343
  • Loading branch information
mbautin committed Apr 3, 2019
1 parent 33835b0 commit a4c614f
Show file tree
Hide file tree
Showing 22 changed files with 800 additions and 368 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ compile_commands.json

# This might be added by some editors' Java plugins
ent/java/yb-cqlent/bin/

test_results.json
test_failures.json
*_test_report.json
5 changes: 2 additions & 3 deletions bin/repeat_unit_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,7 @@ if [[ $iteration -gt 0 ]]; then

set +e
current_timestamp=$( get_timestamp_for_filenames )
export TEST_TMPDIR=/tmp/yb__${script_name_no_ext}_${build_type}_${current_timestamp}_\
$RANDOM.$RANDOM.$RANDOM.$$
export TEST_TMPDIR=/tmp/yb_tests__${current_timestamp}__$RANDOM.$RANDOM.$RANDOM
mkdir -p "$TEST_TMPDIR"
set_expected_core_dir "$TEST_TMPDIR"
if ! "$is_java_test"; then
Expand Down Expand Up @@ -298,7 +297,7 @@ $RANDOM.$RANDOM.$RANDOM.$$
pass_or_fail="PASSED"
if ! did_test_succeed "$exit_code" "$raw_test_log_path"; then
if ! "$is_java_test"; then
postprocess_test_log
postprocess_cxx_test_log
process_core_file
fi
if "$skip_address_already_in_use" && \
Expand Down
16 changes: 16 additions & 0 deletions build-support/common-build-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2047,6 +2047,22 @@ activate_virtualenv() {
run_with_retries 10 0.5 pip2 install -r "$YB_SRC_ROOT/python_requirements_frozen.txt" \
$pip_no_cache
fi

if [[ ${YB_DEBUG_VIRTUALENV:-0} == "1" ]]; then
echo >&2 "
VIRTUALENV DEBUGGING
--------------------
Activated virtualenv in: $virtualenv_dir
Executable: $0
PATH: $PATH
PYTHONPATH: ${PYTHONPATH:-undefined}
VIRTUAL_ENV: ${VIRTUAL_ENV:-undefined}
"
fi

export VIRTUAL_ENV
}

check_python_interpreter_version() {
Expand Down
Loading

0 comments on commit a4c614f

Please sign in to comment.