All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org,
	"Michał Winiarski" <michal.winiarski@intel.com>
Subject: [Intel-gfx] [PATCH i-g-t v2 03/16] tests/core_hotunplug: Consolidate duplicated debug messages
Date: Fri,  7 Aug 2020 11:19:49 +0200	[thread overview]
Message-ID: <20200807092002.32350-4-janusz.krzysztofik@linux.intel.com> (raw)
In-Reply-To: <20200807092002.32350-1-janusz.krzysztofik@linux.intel.com>

Some debug messages which designate specific test operations, or their
greater parts at least, sound always the same, no matter which subtest
they are called from.  Emit them, possibly updated with subtest
specified modifiers, from inside respective helpers instead of
duplicating them in subtest bodies.

v2: Rebase on current upstream master.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
---
 tests/core_hotunplug.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index a4071f51e..557f9e3fa 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -90,8 +90,11 @@ static void prepare(struct hotunplug *priv, char *buf, int buflen)
 static const char *failure;
 
 /* Unbind the driver from the device */
-static void driver_unbind(int fd_sysfs_drv, const char *dev_bus_addr)
+static void driver_unbind(int fd_sysfs_drv, const char *dev_bus_addr,
+			  const char *prefix)
 {
+	igt_debug("%sunbinding the driver from the device\n", prefix);
+
 	failure = "Driver unbind timeout!";
 	igt_set_timeout(60, failure);
 	igt_sysfs_set(fd_sysfs_drv, "unbind", dev_bus_addr);
@@ -104,6 +107,8 @@ static void driver_unbind(int fd_sysfs_drv, const char *dev_bus_addr)
 /* Re-bind the driver to the device */
 static void driver_bind(int fd_sysfs_drv, const char *dev_bus_addr)
 {
+	igt_debug("rebinding the driver to the device\n");
+
 	failure = "Driver re-bind timeout!";
 	igt_set_timeout(60, failure);
 	igt_sysfs_set(fd_sysfs_drv, "bind", dev_bus_addr);
@@ -114,8 +119,10 @@ static void driver_bind(int fd_sysfs_drv, const char *dev_bus_addr)
 }
 
 /* Remove (virtually unplug) the device from its bus */
-static void device_unplug(int fd_sysfs_dev)
+static void device_unplug(int fd_sysfs_dev, const char *prefix)
 {
+	igt_debug("%sunplugging the device\n", prefix);
+
 	failure = "Device unplug timeout!";
 	igt_set_timeout(60, failure);
 	igt_sysfs_set(fd_sysfs_dev, "device/remove", "1");
@@ -128,6 +135,8 @@ static void device_unplug(int fd_sysfs_dev)
 /* Re-discover the device by rescanning its bus */
 static void bus_rescan(int fd_sysfs_bus)
 {
+	igt_debug("recovering the device\n");
+
 	failure = "Bus rescan timeout!";
 	igt_set_timeout(60, failure);
 	igt_sysfs_set(fd_sysfs_bus, "rescan", "1");
@@ -184,10 +193,8 @@ static void unbind_rebind(void)
 	igt_debug("closing the device\n");
 	close(priv.fd.drm);
 
-	igt_debug("unbinding the driver from the device\n");
-	driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr);
+	driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr, "");
 
-	igt_debug("rebinding the driver to the device\n");
 	driver_bind(priv.fd.sysfs_drv, priv.dev_bus_addr);
 
 	healthcheck();
@@ -202,10 +209,8 @@ static void unplug_rescan(void)
 	igt_debug("closing the device\n");
 	close(priv.fd.drm);
 
-	igt_debug("unplugging the device\n");
-	device_unplug(priv.fd.sysfs_dev);
+	device_unplug(priv.fd.sysfs_dev, "");
 
-	igt_debug("recovering the device\n");
 	bus_rescan(priv.fd.sysfs_bus);
 
 	healthcheck();
@@ -218,10 +223,8 @@ static void hotunbind_lateclose(void)
 
 	prepare(&priv, buf, sizeof(buf));
 
-	igt_debug("hot unbinding the driver from the device\n");
-	driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr);
+	driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr, "hot ");
 
-	igt_debug("rebinding the driver to the device\n");
 	driver_bind(priv.fd.sysfs_drv, priv.dev_bus_addr);
 
 	igt_debug("late closing the unbound device instance\n");
@@ -236,10 +239,8 @@ static void hotunplug_lateclose(void)
 
 	prepare(&priv, NULL, 0);
 
-	igt_debug("hot unplugging the device\n");
-	device_unplug(priv.fd.sysfs_dev);
+	device_unplug(priv.fd.sysfs_dev, "hot ");
 
-	igt_debug("recovering the device\n");
 	bus_rescan(priv.fd.sysfs_bus);
 
 	igt_debug("late closing the removed device instance\n");
-- 
2.21.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org,
	"Michał Winiarski" <michal.winiarski@intel.com>,
	"Petri Latvala" <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t v2 03/16] tests/core_hotunplug: Consolidate duplicated debug messages
Date: Fri,  7 Aug 2020 11:19:49 +0200	[thread overview]
Message-ID: <20200807092002.32350-4-janusz.krzysztofik@linux.intel.com> (raw)
In-Reply-To: <20200807092002.32350-1-janusz.krzysztofik@linux.intel.com>

Some debug messages which designate specific test operations, or their
greater parts at least, sound always the same, no matter which subtest
they are called from.  Emit them, possibly updated with subtest
specified modifiers, from inside respective helpers instead of
duplicating them in subtest bodies.

v2: Rebase on current upstream master.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
---
 tests/core_hotunplug.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index a4071f51e..557f9e3fa 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -90,8 +90,11 @@ static void prepare(struct hotunplug *priv, char *buf, int buflen)
 static const char *failure;
 
 /* Unbind the driver from the device */
-static void driver_unbind(int fd_sysfs_drv, const char *dev_bus_addr)
+static void driver_unbind(int fd_sysfs_drv, const char *dev_bus_addr,
+			  const char *prefix)
 {
+	igt_debug("%sunbinding the driver from the device\n", prefix);
+
 	failure = "Driver unbind timeout!";
 	igt_set_timeout(60, failure);
 	igt_sysfs_set(fd_sysfs_drv, "unbind", dev_bus_addr);
@@ -104,6 +107,8 @@ static void driver_unbind(int fd_sysfs_drv, const char *dev_bus_addr)
 /* Re-bind the driver to the device */
 static void driver_bind(int fd_sysfs_drv, const char *dev_bus_addr)
 {
+	igt_debug("rebinding the driver to the device\n");
+
 	failure = "Driver re-bind timeout!";
 	igt_set_timeout(60, failure);
 	igt_sysfs_set(fd_sysfs_drv, "bind", dev_bus_addr);
@@ -114,8 +119,10 @@ static void driver_bind(int fd_sysfs_drv, const char *dev_bus_addr)
 }
 
 /* Remove (virtually unplug) the device from its bus */
-static void device_unplug(int fd_sysfs_dev)
+static void device_unplug(int fd_sysfs_dev, const char *prefix)
 {
+	igt_debug("%sunplugging the device\n", prefix);
+
 	failure = "Device unplug timeout!";
 	igt_set_timeout(60, failure);
 	igt_sysfs_set(fd_sysfs_dev, "device/remove", "1");
@@ -128,6 +135,8 @@ static void device_unplug(int fd_sysfs_dev)
 /* Re-discover the device by rescanning its bus */
 static void bus_rescan(int fd_sysfs_bus)
 {
+	igt_debug("recovering the device\n");
+
 	failure = "Bus rescan timeout!";
 	igt_set_timeout(60, failure);
 	igt_sysfs_set(fd_sysfs_bus, "rescan", "1");
@@ -184,10 +193,8 @@ static void unbind_rebind(void)
 	igt_debug("closing the device\n");
 	close(priv.fd.drm);
 
-	igt_debug("unbinding the driver from the device\n");
-	driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr);
+	driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr, "");
 
-	igt_debug("rebinding the driver to the device\n");
 	driver_bind(priv.fd.sysfs_drv, priv.dev_bus_addr);
 
 	healthcheck();
@@ -202,10 +209,8 @@ static void unplug_rescan(void)
 	igt_debug("closing the device\n");
 	close(priv.fd.drm);
 
-	igt_debug("unplugging the device\n");
-	device_unplug(priv.fd.sysfs_dev);
+	device_unplug(priv.fd.sysfs_dev, "");
 
-	igt_debug("recovering the device\n");
 	bus_rescan(priv.fd.sysfs_bus);
 
 	healthcheck();
@@ -218,10 +223,8 @@ static void hotunbind_lateclose(void)
 
 	prepare(&priv, buf, sizeof(buf));
 
-	igt_debug("hot unbinding the driver from the device\n");
-	driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr);
+	driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr, "hot ");
 
-	igt_debug("rebinding the driver to the device\n");
 	driver_bind(priv.fd.sysfs_drv, priv.dev_bus_addr);
 
 	igt_debug("late closing the unbound device instance\n");
@@ -236,10 +239,8 @@ static void hotunplug_lateclose(void)
 
 	prepare(&priv, NULL, 0);
 
-	igt_debug("hot unplugging the device\n");
-	device_unplug(priv.fd.sysfs_dev);
+	device_unplug(priv.fd.sysfs_dev, "hot ");
 
-	igt_debug("recovering the device\n");
 	bus_rescan(priv.fd.sysfs_bus);
 
 	igt_debug("late closing the removed device instance\n");
-- 
2.21.1

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

  parent reply	other threads:[~2020-08-07  9:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07  9:19 [Intel-gfx] [PATCH i-g-t v2 00/16] tests/core_hotunplug: Fixes and enhancements Janusz Krzysztofik
2020-08-07  9:19 ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 01/16] tests/core_hotunplug: Use igt_assert_fd() Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 02/16] tests/core_hotunplug: Constify dev_bus_addr string Janusz Krzysztofik
2020-08-07  9:19   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:19 ` Janusz Krzysztofik [this message]
2020-08-07  9:19   ` [igt-dev] [PATCH i-g-t v2 03/16] tests/core_hotunplug: Consolidate duplicated debug messages Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 04/16] tests/core_hotunplug: Assert successful device filter application Janusz Krzysztofik
2020-08-07  9:19   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 05/16] tests/core_hotunplug: Fix missing newline Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 06/16] tests/core_hotunplug: Maintain a single data structure instance Janusz Krzysztofik
2020-08-07  9:19   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 07/16] tests/core_hotunplug: Pass errors via a data structure field Janusz Krzysztofik
2020-08-07  9:19   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 08/16] tests/core_hotunplug: Handle device close errors Janusz Krzysztofik
2020-08-07  9:19   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 09/16] tests/core_hotunplug: Prepare invariant data once per test run Janusz Krzysztofik
2020-08-07  9:19   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 10/16] tests/core_hotunplug: Skip selectively on sysfs close errors Janusz Krzysztofik
2020-08-07  9:19   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 11/16] tests/core_hotunplug: Follow failed subtests with health checks Janusz Krzysztofik
2020-08-07  9:19   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 12/16] tests/core_hotunplug: Fail subtests on device close errors Janusz Krzysztofik
2020-08-07  9:19   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:19 ` [Intel-gfx] [PATCH i-g-t v2 13/16] tests/core_hotunplug: Process return values of sysfs operations Janusz Krzysztofik
2020-08-07  9:19   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:20 ` [Intel-gfx] [PATCH i-g-t v2 14/16] tests/core_hotunplug: Assert expected device presence/absence Janusz Krzysztofik
2020-08-07  9:20 ` [Intel-gfx] [PATCH i-g-t v2 15/16] tests/core_hotunplug: Explicitly ignore unused return values Janusz Krzysztofik
2020-08-07  9:20   ` [igt-dev] " Janusz Krzysztofik
2020-08-07  9:20 ` [Intel-gfx] [PATCH i-g-t 16/16] tests/core_hotunplug: Un-blocklist *unbind* subtests Janusz Krzysztofik
2020-08-07 11:53 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/core_hotunplug: Fixes and enhancements (rev2) Patchwork
2020-08-07 14:08 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-08-10  9:33 ` [Intel-gfx] [PATCH i-g-t v2 00/16] tests/core_hotunplug: Fixes and enhancements Janusz Krzysztofik
2020-08-10  9:33   ` [igt-dev] " Janusz Krzysztofik

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=20200807092002.32350-4-janusz.krzysztofik@linux.intel.com \
    --to=janusz.krzysztofik@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=michal.winiarski@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.