diff options
author | Abdiel Janulgue <abdiel.janulgue@linux.intel.com> | 2017-04-13 13:43:20 +0300 |
---|---|---|
committer | Abdiel Janulgue <abdiel.janulgue@linux.intel.com> | 2017-06-14 11:06:55 +0300 |
commit | 51f4f9f9ab320e681057bdd203445e725ad04768 (patch) | |
tree | 1038d386adbc6d17cf6140196b1f8693fc7ff785 /lib/igt_core.h | |
parent | 5d494bdaec4280ff841baa4b0bdd61a0bb7816c9 (diff) |
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 <petri.latvala@intel.com>
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib/igt_core.h')
-rw-r--r-- | lib/igt_core.h | 10 |
1 files changed, 10 insertions, 0 deletions
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 */ |