From b1953aa5ef509032ee96e3b34412b681fd6d950a Mon Sep 17 00:00:00 2001 From: Joachim Reichel <43646584+jreichel-nvidia@users.noreply.github.com> Date: Thu, 23 Jul 2026 16:16:37 +0200 Subject: [PATCH] Add regex filter to tests_to_html.py. This allows to focus the output on a particular set of results without the need to actually remove the unwanted results from disk. --- python/MaterialXTest/tests_to_html.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/python/MaterialXTest/tests_to_html.py b/python/MaterialXTest/tests_to_html.py index d568b0dfe4..d911f84655 100644 --- a/python/MaterialXTest/tests_to_html.py +++ b/python/MaterialXTest/tests_to_html.py @@ -4,6 +4,7 @@ import os import datetime import argparse +import re try: # Install pillow via pip to enable image differencing and statistics. @@ -78,10 +79,16 @@ def main(args=None): parser.add_argument('-l2', '--lang2', dest='lang2', action='store', help='Second target language for comparison. Default is osl', default="osl") parser.add_argument('-l3', '--lang3', dest='lang3', action='store', help='Third target language for comparison. Default is empty', default="") parser.add_argument('-e', '--error', dest='error', action='store', help='Filter out results with RMS less than this. Negative means all results are kept.', default=-1, type=float) + parser.add_argument('-r', '--regex', dest='regex', action='store', help='Filter out results whose relative paths do not match this case-insensitive regular expression.', default="") parser.add_argument('-of', '--order-from', dest='order_from', action='store', help='Path to a MaterialX _options.mtlx file. When provided, output sections are ordered to match its renderTestPaths input.', default="") args = parser.parse_args(args) + try: + resultRegex = re.compile(args.regex, re.IGNORECASE) + except re.error as e: + parser.error("invalid regular expression: " + str(e)) + fh = open(args.outputfile,"w+") fh.write("\n") fh.write("