All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt] igt/tools_test: Check the tools exist before executing
@ 2017-12-12 17:22 Chris Wilson
  2017-12-12 17:39 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: Chris Wilson @ 2017-12-12 17:22 UTC (permalink / raw)
  To: intel-gfx

As a simple fail-safe against a bad installation, check the tools exist
before testing whether they work.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102935
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/tools_test.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/tests/tools_test.c b/tests/tools_test.c
index 6aea7a8a4..a4fc68e8b 100644
--- a/tests/tools_test.c
+++ b/tests/tools_test.c
@@ -26,6 +26,9 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <unistd.h>
+
+#define TOOLS "../tools/"
 
 struct line_check {
 	int found;
@@ -112,17 +115,13 @@ igt_main
 	}
 
 	igt_subtest("tools_test") {
-		char *cmd;
-
-		igt_assert(asprintf(&cmd,
-				    "../tools/intel_reg read 0x4030")
-			   != -1);
-		igt_assert(igt_system_quiet(cmd) == IGT_EXIT_SUCCESS);
-		free(cmd);
-
-		igt_assert(asprintf(&cmd, "../tools/intel_reg dump")
-			   != -1);
-		igt_assert(igt_system_quiet(cmd) == IGT_EXIT_SUCCESS);
-		free(cmd);
+		igt_require(access(TOOLS "intel_reg_read", X_OK) == 0);
+		igt_require(access(TOOLS "intel_reg_dump", X_OK) == 0);
+
+		igt_assert_eq(igt_system_quiet(TOOLS "intel_reg read 0x4030"),
+			      IGT_EXIT_SUCCESS);
+
+		igt_assert_eq(igt_system_quiet(TOOLS "intel_reg dump"),
+			      IGT_EXIT_SUCCESS);
 	}
 }
-- 
2.15.1

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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-12-14 23:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-12 17:22 [PATCH igt] igt/tools_test: Check the tools exist before executing Chris Wilson
2017-12-12 17:39 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-12-12 18:45 ` ✗ Fi.CI.IGT: warning " Patchwork
2017-12-13  9:53 ` [PATCH igt] " Petri Latvala
2017-12-13 10:48 ` Joonas Lahtinen
2017-12-13 14:56 ` [PATCH igt v2] " Chris Wilson
2017-12-14 11:11   ` Petri Latvala
2017-12-14 11:14     ` Chris Wilson
2017-12-14 11:20       ` Petri Latvala
2017-12-14 11:24         ` Chris Wilson
2017-12-14 12:39           ` Petri Latvala
2017-12-13 17:16 ` ✓ Fi.CI.BAT: success for igt/tools_test: Check the tools exist before executing (rev2) Patchwork
2017-12-13 18:59 ` ✗ Fi.CI.IGT: warning " Patchwork
2017-12-14 11:39 ` [PATCH igt v3] igt/tools_test: Check the tools exist before executing Chris Wilson
2017-12-14 11:57 ` ✗ Fi.CI.BAT: warning for igt/tools_test: Check the tools exist before executing (rev3) Patchwork
2017-12-14 21:57 ` ✓ Fi.CI.BAT: success " Patchwork
2017-12-14 23:38 ` ✗ Fi.CI.IGT: failure " Patchwork

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.