Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>,
	Martin Peres <martin.peres@linux.intel.com>
Subject: [igt-dev] [PATCH i-g-t 2/4] uwildmat: Case-insensitive test selection
Date: Mon, 30 Apr 2018 12:28:46 +0300	[thread overview]
Message-ID: <20180430092848.10830-3-petri.latvala@intel.com> (raw)
In-Reply-To: <20180430092848.10830-1-petri.latvala@intel.com>

Since we only use plain ascii in subtest names, using non-locale-aware
tolower() to compare case-insensitively works.

Doing this within uwildmat instead of tolowering the subtest name and
then calling uwildmat() is required, because of selection strings
like:

foo,bar,!Foo

The above line will select subtest Bar, and not select Foo.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
Cc: Martin Peres <martin.peres@linux.intel.com>
---
 lib/uwildmat/uwildmat.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/uwildmat/uwildmat.c b/lib/uwildmat/uwildmat.c
index 09155865..3beafce2 100644
--- a/lib/uwildmat/uwildmat.c
+++ b/lib/uwildmat/uwildmat.c
@@ -93,6 +93,7 @@
  **  accompanying test suite achieves 100% coverage of this file.
  */
 
+#include <ctype.h>
 #include <string.h>
 #include <stdint.h>
 #include "uwildmat/uwildmat.h"
@@ -222,6 +223,7 @@ match_class(uint32_t text, const unsigned char *start,
 	const unsigned char *p = start;
 	uint32_t first = 0;
 	uint32_t last;
+	uint32_t lc = tolower(text);
 
 	/* Check for an inverted character class (starting with ^).  If the
 	   character matches the character class, we return !reversed; that way,
@@ -244,12 +246,13 @@ match_class(uint32_t text, const unsigned char *start,
 		if (allowrange && *p == '-' && p < end) {
 			p++;
 			p += utf8_decode(p, end, &last);
-			if (text >= first && text <= last)
+			if ((text >= first && text <= last) ||
+			    (lc >= first && lc <= last))
 				return !reversed;
 			allowrange = false;
 		} else {
 			p += utf8_decode(p, end, &first);
-			if (text == first)
+			if (text == first || lc == first)
 				return !reversed;
 			allowrange = true;
 		}
@@ -272,6 +275,7 @@ match_pattern(const unsigned char *text, const unsigned char *start,
 	bool ismeta;
 	int matched, width;
 	uint32_t c;
+	unsigned char lc;
 
 	for (; p <= end; p++) {
 		if (!*text && *p != '*')
@@ -284,7 +288,8 @@ match_pattern(const unsigned char *text, const unsigned char *start,
 			/* Fall through. */
 
 		default:
-			if (*text++ != *p)
+			lc = tolower(*text);
+			if (*text++ != *p && lc != *p)
 				return false;
 			break;
 
-- 
2.14.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2018-04-30  9:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30  9:28 [igt-dev] [PATCH i-g-t 0/4] New runner to rule them all Petri Latvala
2018-04-30  9:28 ` [igt-dev] [PATCH i-g-t 1/4] lib: Print subtest starting/ending line to stderr too Petri Latvala
2018-04-30  9:28 ` Petri Latvala [this message]
2018-04-30  9:28 ` [igt-dev] [PATCH i-g-t 3/4] runner: New test runner Petri Latvala
2018-05-03 12:04   ` Arkadiusz Hiler
2018-05-04 13:45   ` Arkadiusz Hiler
2018-05-07 18:34   ` Daniel Vetter
2018-05-24  8:40     ` Petri Latvala
2018-05-08  8:47   ` Arkadiusz Hiler
2018-05-08  8:50     ` Chris Wilson
2018-05-11 10:45   ` Arkadiusz Hiler
2018-05-11 10:50     ` Chris Wilson
2018-05-11 10:51       ` Chris Wilson
2018-04-30  9:28 ` [igt-dev] [PATCH i-g-t 4/4] runner: Unit tests for the runner Petri Latvala
2018-04-30 14:54 ` [igt-dev] ✓ Fi.CI.BAT: success for New runner to rule them all Patchwork
2018-04-30 20:13 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-05-11 11:24 ` [igt-dev] [PATCH i-g-t 0/4] " David Weinehall
2018-06-04 22:17 ` Eric Anholt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180430092848.10830-3-petri.latvala@intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=martin.peres@linux.intel.com \
    --cc=tomi.p.sarvela@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox