From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 2/2] lib/igt_kmod: Simplify kunit_set_filtering()
Date: Wed, 30 Oct 2024 17:31:42 -0700 [thread overview]
Message-ID: <20241031003142.863437-3-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20241031003142.863437-1-lucas.demarchi@intel.com>
igt_sysfs_set() already supports setting a 0-length value since commit
1c0b492a0b5c ("lib/igt_sysfs: make sure to write empty strings").
Remove workaround in kunit_set_filtering() and simplify.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
lib/igt_kmod.c | 40 +++++-----------------------------------
1 file changed, 5 insertions(+), 35 deletions(-)
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 4cb9e886d..5fd500384 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -939,7 +939,7 @@ static bool kunit_set_filtering(const char *filter_glob, const char *filter,
const char *filter_action)
{
int params;
- bool ret;
+ bool ret = true;
params = open_parameters("kunit");
if (igt_debug_on(params < 0))
@@ -952,41 +952,11 @@ static bool kunit_set_filtering(const char *filter_glob, const char *filter,
* As a workaround, we use non-NULL strings that exhibit
* the same behaviour as if default NULLs were in place.
*/
- ret = !igt_debug_on(!igt_sysfs_set(params, "filter_glob",
- filter_glob ?: "*"));
- if (!ret)
- goto close;
+ if (igt_debug_on(!igt_sysfs_set(params, "filter_glob", filter_glob ?: "*")) ||
+ igt_debug_on(!igt_sysfs_set(params, "filter", filter ?: "module!=none")) ||
+ igt_debug_on(!igt_sysfs_set(params, "filter_action", filter_action ?: "")))
+ ret = false;
- ret = !igt_debug_on(!igt_sysfs_set(params, "filter",
- filter ?: "module!=none"));
- if (!ret)
- goto close;
-
- ret = !igt_debug_on(!igt_sysfs_set(params, "filter_action",
- filter_action ?: ""));
-
- /*
- * TODO: Drop the extra check below as soon as igt_sysfs_set()
- * can correctly process empty strings which we are using
- * as filter_action NULL equivalent.
- *
- * We need this check only when NULL is requested for "filter_action"
- * and not for "filter" parameter, otherwise, even if "filter_action"
- * was previously set to "skip", we don't care since our
- * "module!=none" default filter guarantees that no test cases are
- * filtered out to be processed as "filter_action" says.
- */
- if (ret && !filter_action && filter) {
- filter_action = igt_sysfs_get(params, "filter_action");
-
- ret = !(igt_debug_on_f(!filter_action,
- "open() failed\n") ||
- igt_debug_on_f(strlen(filter_action),
- "empty string not applied\n"));
- free((char *)filter_action);
- }
-
-close:
close(params);
return ret;
--
2.47.0
next prev parent reply other threads:[~2024-10-31 0:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 0:31 [PATCH i-g-t 0/2] lib/igt_kmod: Drop legacy kunit integration Lucas De Marchi
2024-10-31 0:31 ` [PATCH i-g-t 1/2] lib/igt_kmod: Drop legacy kunit fallback Lucas De Marchi
2024-10-31 10:42 ` Janusz Krzysztofik
2024-10-31 13:18 ` Lucas De Marchi
2024-10-31 14:58 ` Janusz Krzysztofik
2024-11-04 23:03 ` Lucas De Marchi
2024-10-31 0:31 ` Lucas De Marchi [this message]
2024-10-31 10:35 ` [PATCH i-g-t 2/2] lib/igt_kmod: Simplify kunit_set_filtering() Janusz Krzysztofik
2024-10-31 2:22 ` ✓ CI.xeBAT: success for lib/igt_kmod: Drop legacy kunit integration Patchwork
2024-10-31 2:45 ` ✓ Fi.CI.BAT: " Patchwork
2024-10-31 4:41 ` ✗ CI.xeFULL: failure " Patchwork
2024-10-31 13:16 ` ✗ Fi.CI.IGT: " Patchwork
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=20241031003142.863437-3-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=janusz.krzysztofik@linux.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