Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zts-report: don't crash on non-UTF-8 chars in the log #16497

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

robn
Copy link
Member

@robn robn commented Sep 1, 2024

Motivation and Context

I'm very sick of getting Python stacktraces instead of nice test reports.

Description

The report generator expects the log to be clean and tidy UTF-8. That can be a problem if you use some of the verbose/debug test runner options, which sends all sorts of weird output from arbitrary programs to the log.

This just makes Python a little more relaxed about such things. It shouldn't matter in practice, as those lines didn't match the test result regex anyway, and are discarded immediately.

How Has This Been Tested?

Do a full test run with super aggressive debug output:

$ /usr/local/share/zfs/zfs-tests.sh -DvKx

Come back tomorrow, and enjoy the crash:

Results Summary
PASS     1712
FAIL      33
SKIP      30
KILLED     4

Running Time:   06:29:26
Percent passed: 96.2%
Log directory:  /var/tmp/test_results/20240831T183324
Traceback (most recent call last):
  File "/usr/local/share/zfs/test-runner/bin/zts-report.py", line 445, in <module>
    results, logdir = process_results(args.logfile)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/share/zfs/test-runner/bin/zts-report.py", line 406, in process_results
    for line in f.readlines():
                ^^^^^^^^^^^^^
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 7761: invalid continuation byte

Apply this patch and try again:

$ ./tests/test-runner/bin/zts-report.py /var/tmp/test_results/20240831T183324/log

Tests with results other than PASS that are expected:
    FAIL append/threadsappend_001_pos (https://github.com/openzfs/zfs/issues/6136)
    FAIL casenorm/mixed_formd_delete (https://github.com/openzfs/zfs/issues/7633)
    FAIL casenorm/mixed_formd_lookup (https://github.com/openzfs/zfs/issues/7633)
...

Tests with result of PASS that are unexpected:

Tests with results other than PASS that are unexpected:
    FAIL cli_root/json/json_sanity (expected PASS)
    FAIL cli_root/zdb/zdb_args_pos (expected PASS)
    FAIL cli_root/zfs_load-key/zfs_load-key_all (expected PASS)
...

Of course, now I gotta fix what I broke, but hey, you can't fix a problem you don't know about.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

The report generator expects the log to be clean and tidy UTF-8. That
can be a problem if you use some of the verbose/debug test runner
options, which sends all sorts of weird output from arbitrary programs
to the log.

This just makes Python a little more relaxed about such things. It
shouldn't matter in practice, as those lines didn't match the test
result regex anyway, and are discarded immediately.

Signed-off-by: Rob Norris <robn@despairlabs.com>
Sponsored-by: https://despairlabs.com/sponsor/
@tonyhutter tonyhutter merged commit 63253db into openzfs:master Sep 10, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants