[Piglit] [PATCH 2/2] profile_tests.py: Fix -x and -i with lowercased names

Dylan Baker baker.dylan.c at gmail.com
Tue Feb 24 12:14:57 PST 2015


In ea381355a0625a1 all test names were stored lowercase. The reasons for
this are outlined in that commit message, and while the summary was
updated to correctly handle these changes the -x and -i options were
not.

This patch corrects that by making the regex that the -i and -x options
are converted into case insensitive, and adds a testcase to the
framework tests to demonstrate the behavior.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/core.py                |  6 ++++--
 framework/tests/profile_tests.py | 13 ++++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/framework/core.py b/framework/core.py
index f3022c9..dfc8f6a 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -99,8 +99,10 @@ class Options(object):
                  exclude_filter=None, valgrind=False, dmesg=False, sync=False):
         self.concurrent = concurrent
         self.execute = execute
-        self.filter = [re.compile(x) for x in include_filter or []]
-        self.exclude_filter = [re.compile(x) for x in exclude_filter or []]
+        self.filter = \
+            [re.compile(x, re.IGNORECASE) for x in include_filter or []]
+        self.exclude_filter = \
+            [re.compile(x, re.IGNORECASE) for x in exclude_filter or []]
         self.exclude_tests = set()
         self.valgrind = valgrind
         self.dmesg = dmesg
diff --git a/framework/tests/profile_tests.py b/framework/tests/profile_tests.py
index 1f94b19..d8e75c2 100644
--- a/framework/tests/profile_tests.py
+++ b/framework/tests/profile_tests.py
@@ -204,7 +204,8 @@ class TestPrepareTestListMatches(object):
         self.data = {
             'group1/test1': 'thingy',
             'group1/group3/test2': 'thing',
-            'group3/test5': 'other'
+            'group3/test5': 'other',
+            'group4/Test9': 'is_caps',
         }
 
     def test_matches_filter_mar_1(self):
@@ -263,3 +264,13 @@ class TestPrepareTestListMatches(object):
         del baseline['group3/test5']
 
         nt.assert_dict_equal(profile_.test_list, baseline)
+
+    def test_matches_include_caps(self):
+        """TestProfile.prepare_test_list: matches capitalized tests."""
+        env = core.Options(exclude_filter=['test9'])
+
+        profile_ = profile.TestProfile()
+        profile_.test_list = self.data
+        profile_._prepare_test_list(env)
+
+        nt.assert_not_in('group4/Test9', profile_.test_list)
-- 
2.3.0



More information about the Piglit mailing list