This is an archive of the discontinued LLVM Phabricator instance.

[UpdateTestChecks] Add --filter and --filter-out options
ClosedPublic

Authored by greened on Jan 19 2022, 9:40 AM.

Details

Summary

Enhance the various update_*_test_checks.py tools to allow filtering the tool
output with regular expressions. The --filter option will emit only tool output
lines matching the given regular expression while the --filter-out option will
emit only tools output lines not matching the given regular expression. Filters
are applied in order of appearance on the command line (or in UTC_ARGS) and the
first matching filter terminates the search.

This allows test authors to create more focused tests by removing irrelevant
tool output and checking only the pieces of output necessary to test the desired
functionality.

Diff Detail

Event Timeline

greened requested review of this revision.Jan 19 2022, 9:40 AM
greened created this revision.

I like this. No real concern, maybe someone else want's to take a look, otherwise I can accept this.

llvm/utils/UpdateTestChecks/common.py
44
101

I only browsed the above code, looks good enough to me.

1045

pattern seemed to have been to use continue.

greened added inline comments.Jan 21 2022, 1:46 PM
llvm/utils/UpdateTestChecks/common.py
101

Yeah it's kind of unfortunate this has to be this complicated just to support deep copy. Python 3.7 regexp objects support deep copy but we don't (yet?) require python 3.7.

greened updated this revision to Diff 402105.Jan 21 2022, 2:07 PM

Fixed typo.

greened marked an inline comment as done.Jan 21 2022, 2:07 PM
greened updated this revision to Diff 402114.Jan 21 2022, 2:53 PM

Fixed a brown paper bag bug (filter-out was not working).

Ping. Can we merge this?

This revision is now accepted and ready to land.Jan 28 2022, 9:32 AM
This revision was landed with ongoing or failed builds.Jan 28 2022, 2:11 PM
This revision was automatically updated to reflect the committed changes.
dyung added a subscriber: dyung.Jan 28 2022, 3:32 PM

Your change seems to be causing some test failures on a buildbot, can you take a look?

https://lab.llvm.org/buildbot/#/builders/139/builds/17109

greened updated this revision to Diff 404695.Jan 31 2022, 1:10 PM

Updated with bug fixes. Posting so that future visitors will see the change mentioned in the Differential Revision field of the commit message.

This revision was landed with ongoing or failed builds.Jan 31 2022, 1:12 PM

Should update_analyze_test_checks.py have been included in this? I'm getting an error like

  File "llvm/utils/UpdateTestChecks/common.py", line 435, in __init__
    flags.filters)) if flags.filters else []
AttributeError: type object '' has no attribute 'filters'
JOE1994 added a subscriber: JOE1994.Mar 1 2022, 6:23 PM

I see 6 non-temporal store instructions in "llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86-non-temporal.ll",
but the expected output ("llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86-non-temporal.ll.filter.expected") checks for only 5 non-temporal instructions.

Shouldn't the expected output check for 6 non-temporal stores instead of 5 ?

Thank you

Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 6:23 PM

I see 6 non-temporal store instructions in "llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86-non-temporal.ll",
but the expected output ("llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86-non-temporal.ll.filter.expected") checks for only 5 non-temporal instructions.

Shouldn't the expected output check for 6 non-temporal stores instead of 5 ?

Thank you

Yes, the first matched line is skipped. There’s a fix in D119704, but nobody felt inclined to review this yet.