From 51f4f9f9ab320e681057bdd203445e725ad04768 Mon Sep 17 00:00:00 2001 From: Abdiel Janulgue Date: Thu, 13 Apr 2017 13:43:20 +0300 Subject: lib/igt_core: Add igt_system helpers Support executing external processes with the goal of capturing its standard streams to the igt logging infrastructure in addition to its exit status. v3: Rename igt_exec -> igt_system (Chris). v2: Fix leaks on fd teardown. Make sure redirected process printout when > 64kb still works, like full dmesg. (Petri). Cc: Petri Latvala Signed-off-by: Abdiel Janulgue Reviewed-by: Arkadiusz Hiler --- lib/igt_core.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/igt_core.h') diff --git a/lib/igt_core.h b/lib/igt_core.h index 4a125af1..1855c5e3 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -919,4 +919,14 @@ FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir, #define igt_fopen_data(filename) \ __igt_fopen_data(IGT_SRCDIR, IGT_DATADIR, filename) +int igt_system(const char *command); +int igt_system_quiet(const char *command); +#define igt_system_cmd(status, format...) \ + do { \ + char *buf = 0; \ + igt_assert(asprintf(&buf, format) != -1); \ + status = igt_system(buf); \ + free(buf); \ + } while (0) + #endif /* IGT_CORE_H */ -- cgit v1.2.3