summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2014-09-30 17:05:39 +0100
committerThomas Wood <thomas.wood@intel.com>2014-09-30 17:54:12 +0100
commit6a8d33c2bb81f071715864c2e563ac17ae4f9967 (patch)
tree655b284e6b73e0695fecd90b1d7a615255aff7d1
parentc2d5519906f3b7d75b4fbf14c61c5f54d9d75214 (diff)
lib: add a function to indicate activity
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
-rw-r--r--lib/igt_aux.c15
-rw-r--r--lib/igt_aux.h1
-rw-r--r--tests/kms_cursor_crc.c3
-rw-r--r--tests/kms_fence_pin_leak.c4
-rw-r--r--tests/kms_flip.c2
5 files changed, 21 insertions, 4 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index c0ea0e20..7c07b7d0 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -246,6 +246,21 @@ void igt_progress(const char *header, uint64_t i, uint64_t total)
(long long unsigned)i * 100 / total);
}
+/**
+ * igt_print_activity:
+ *
+ * Print a '.' to indicate activity. This is printed without a newline and
+ * only if output is to a terminal.
+ */
+void igt_print_activity(void)
+{
+ if (!isatty(STDOUT_FILENO))
+ return;
+
+ igt_info(".");
+ fflush(stdout);
+}
+
/* mappable aperture trasher helper */
drm_intel_bo **trash_bos;
int num_trash_bos;
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index d958abeb..d74bb8c4 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -41,6 +41,7 @@ void igt_permute_array(void *array, unsigned size,
unsigned i,
unsigned j));
void igt_progress(const char *header, uint64_t i, uint64_t total);
+void igt_print_activity(void);
bool igt_check_boolean_env_var(const char *env_var, bool default_value);
bool igt_aub_dump_enabled(void);
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 845ec167..92d1ce65 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -32,6 +32,7 @@
#include "igt_debugfs.h"
#include "igt_kms.h"
#include "intel_chipset.h"
+#include "igt_aux.h"
#ifndef DRM_CAP_CURSOR_WIDTH
#define DRM_CAP_CURSOR_WIDTH 0x8
@@ -105,7 +106,7 @@ static void do_single_test(data_t *data, int x, int y)
igt_plane_t *cursor;
cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
- igt_info("."); fflush(stdout);
+ igt_print_activity();
/* Hardware test */
igt_paint_test_pattern(cr, data->screenw, data->screenh);
diff --git a/tests/kms_fence_pin_leak.c b/tests/kms_fence_pin_leak.c
index 35587e08..5610ad8b 100644
--- a/tests/kms_fence_pin_leak.c
+++ b/tests/kms_fence_pin_leak.c
@@ -33,6 +33,7 @@
#include "igt_kms.h"
#include "ioctl_wrappers.h"
#include "intel_chipset.h"
+#include "igt_aux.h"
typedef struct {
int drm_fd;
@@ -173,8 +174,7 @@ static bool run_single_test(data_t *data, enum pipe pipe, igt_output_t *output)
igt_plane_set_fb(primary, &fb[!(i&1)]);
igt_display_commit(display);
- igt_info(".");
- fflush(stdout);
+ igt_print_activity();
}
igt_plane_set_fb(primary, NULL);
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 79402713..3cccfdf0 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -885,7 +885,7 @@ static unsigned int run_test_step(struct test_output *o)
join_vblank_wait_thread();
}
- igt_info("."); fflush(stdout);
+ igt_print_activity();
if (do_flip && (o->flags & TEST_HANG)) {
hang = hang_gpu(drm_fd);