From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Janusz Krzysztofik <janusz.krzysztofik@intel.com>,
Petri Latvala <petri.latvala@intel.com>,
"Lee, Simon B" <simon.b.lee@intel.com>,
igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH v5 2/2] tests/core_hot_reload: Accept external workload
Date: Tue, 9 Apr 2019 13:10:59 +0200 [thread overview]
Message-ID: <20190409111059.25296-3-janusz.krzysztofik@linux.intel.com> (raw)
In-Reply-To: <20190409111059.25296-1-janusz.krzysztofik@linux.intel.com>
From: Janusz Krzysztofik <janusz.krzysztofik@intel.com>
Run a user specified command, possibly one of existing tests, in
background instead of the default dummy load to put some alternative
workload on a device while trying to either remove (unplug) the device
from its bus, or unbind the device's driver from it, depending on which
subtest has been selected.
The command selected as the alternative workload should make real use of
the device as much as possible and its execution should take
significantly more than 2 seconds in order to get reliable results from
the test.
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@intel.com>
---
tests/core_hot_reload.c | 51 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 49 insertions(+), 2 deletions(-)
diff --git a/tests/core_hot_reload.c b/tests/core_hot_reload.c
index d862c99c..0d0795dc 100644
--- a/tests/core_hot_reload.c
+++ b/tests/core_hot_reload.c
@@ -33,6 +33,9 @@
#include <unistd.h>
+#define OPT_WORKLOAD_CMD 'c'
+
+
typedef int (*action_t)(int dir);
typedef void (*workload_wait_t)(void *priv);
typedef void (*workload_t)(int device, const void *priv);
@@ -108,6 +111,16 @@ static void spin_batch(int device, const void *priv)
igt_spin_batch_free(device, spin);
}
+/* Workload using external command */
+
+static void ext_cmd(int device, const void *priv)
+{
+ const char *cmd = priv;
+
+ /* just run the user provided command line */
+ igt_system_quiet(cmd);
+}
+
/*
* Skeleton
@@ -200,12 +213,40 @@ static void __workload_wait(void *priv)
}
-igt_main {
+static int opt_handler(int opt, int opt_index, void *data)
+{
+ const char **cmd = data;
+
+ switch (opt) {
+ case 'c':
+ *cmd = strdup(optarg);
+ break;
+ }
+
+ return 0;
+}
+
+int main (int argc, char **argv)
+{
int device, chipset;
char *driver;
struct igt_helper_process proc = {};
workload_wait_t workload_wait;
void *workload_priv;
+ const struct option long_opts[] = {
+ { "workload-cmd", required_argument, 0, OPT_WORKLOAD_CMD },
+ { 0, 0, 0, 0 }
+ };
+ const char *help_str =
+ " --workload-cmd, -c\n"
+ "\t\tCommand line to run in backgroud as an optional workload, e.g.,\n"
+ "\t\tan existing test name, possibly with options/arguments, quoted.\n"
+ "\t\tExecution must take way more than 2 seconds for reliable results.\n"
+ "\t\tNo default - internal dummy load is used if external not specified.\n";
+ const char *cmd = NULL;
+
+ igt_subtest_init_parse_opts(&argc, argv, "", long_opts, help_str,
+ opt_handler, &cmd);
igt_fixture {
char path[PATH_MAX];
@@ -238,7 +279,13 @@ igt_main {
workload_wait = __workload_wait;
workload_priv = &proc;
- __workload(spin_batch, device, NULL, &proc);
+
+ if (cmd) {
+ igt_device_drop_master(device);
+ __workload(ext_cmd, -1, cmd, &proc);
+ } else {
+ __workload(spin_batch, device, NULL, &proc);
+ }
}
igt_subtest("unplug")
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-04-09 11:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 11:10 [igt-dev] [PATCH v5 0/2] Add a new test for driver/device hot reload Janusz Krzysztofik
2019-04-09 11:10 ` [igt-dev] [PATCH v5 1/2] tests: " Janusz Krzysztofik
2019-04-09 14:50 ` Katarzyna Dec
2019-04-10 9:03 ` Janusz Krzysztofik
2019-04-09 11:10 ` Janusz Krzysztofik [this message]
2019-04-09 14:56 ` [igt-dev] [PATCH v5 2/2] tests/core_hot_reload: Accept external workload Katarzyna Dec
2019-04-10 9:14 ` Janusz Krzysztofik
2019-04-12 8:23 ` Katarzyna Dec
2019-04-09 11:46 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add a new test for driver/device hot reload 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=20190409111059.25296-3-janusz.krzysztofik@linux.intel.com \
--to=janusz.krzysztofik@linux.intel.com \
--cc=daniel@ffwll.ch \
--cc=igt-dev@lists.freedesktop.org \
--cc=janusz.krzysztofik@intel.com \
--cc=petri.latvala@intel.com \
--cc=simon.b.lee@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