Skip to contentSkip to conversation

tests/kms_flip: only print the activity indicator if output is a terminal

PATCH In review Thomas Wood 2 participants 6 messages Sep 29, 2014 – Sep 30, 2014 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 tests/kms_flip: only print the activity indicator if output is a terminal

---
 tests/kms_flip.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/kms_flip.c +4 -1
index 3d3aa9b..8551f64 100644
@@ -885,7 +885,10 @@ static unsigned int run_test_step(struct test_output *o)
 		join_vblank_wait_thread();
 	}
 
-	igt_info("."); fflush(stdout);
+	if (isatty(STDOUT_FILENO)) {
+		igt_info(".");
+		fflush(stdout);
+	}
 
 	if (do_flip && (o->flags & TEST_HANG)) {
 		hang = hang_gpu(drm_fd);
Signature · 1 line
2.1.0
#1 lore raw

PATCH 2/4 doc: various spelling and typo fixes

---
 lib/igt_aux.c        | 12 ++++++------
 lib/igt_core.c       | 22 +++++++++++-----------
 lib/igt_core.h       |  4 ++--
 lib/igt_debugfs.c    |  6 +++---
 lib/igt_debugfs.h    |  2 +-
 lib/igt_kms.h        |  2 +-
 lib/intel_mmio.c     |  8 ++++----
 lib/intel_os.c       |  2 +-
 lib/ioctl_wrappers.c | 20 ++++++++++----------
 9 files changed, 39 insertions(+), 39 deletions(-)
lib/igt_aux.c +6 -6
index 180c274..c0ea0e2 100644
@@ -59,7 +59,7 @@
 
 /**
  * SECTION:igt_aux
- * @short_description: Auxiliary libararies and support functions
+ * @short_description: Auxiliary libraries and support functions
  * @title: i-g-t aux
  * @include: igt_aux.h
  *
@@ -222,7 +222,7 @@ void igt_permute_array(void *array, unsigned size,
  *
  * This function draws a progress indicator, which is useful for running
  * long-winded tests manually on the console. To avoid spamming logfiles in
- * automated runs the progress indicator is supressed when not running on a
+ * automated runs the progress indicator is suppressed when not running on a
  * terminal.
  */
 void igt_progress(const char *header, uint64_t i, uint64_t total)
@@ -325,11 +325,11 @@ void igt_system_suspend_autoresume(void)
 }
 
 /**
- * igt_drop_roo:
+ * igt_drop_root:
  *
- * Drop root priviledges and make sure it actually worked. Useful for tests
+ * Drop root privileges and make sure it actually worked. Useful for tests
  * which need to check security constraints. Note that this should only be
- * called from manually forked processes, since the lack of root priviledges
+ * called from manually forked processes, since the lack of root privileges
  * will wreak havoc with the automatic cleanup handlers.
  */
 void igt_drop_root(void)
@@ -350,7 +350,7 @@ void igt_drop_root(void)
  * Waits for a key press when run interactively and when the corresponding debug
  * key is set in the IGT_DEBUG_INTERACTIVE environment variable. Multiple keys
  * can be specified as a comma-separated list or alternatively "all" if a wait
- * should happen for all keys.  When not connected to a terminal the enviroment
+ * should happen for all keys.  When not connected to a terminal the environment
  * setting is ignored and execution immediately continues.
  *
  * This is useful for display tests where under certain situation manual
lib/igt_core.c +11 -11
index 5d41468..f2b4560 100644
@@ -67,7 +67,7 @@
  * @title: i-g-t core
  * @include: igt_core.h
  *
- * This libary implements the core of the i-g-t test support infrastructure.
+ * This library implements the core of the i-g-t test support infrastructure.
  * Main features are the subtest enumeration, cmdline option parsing helpers for
  * subtest handling and various helpers to structure testcases with subtests and
  * handle subtest test results.
@@ -141,9 +141,9 @@
  *   conditions, but instead such assumptions should be written in a declarative
  *   style.  Use one of the many macros which encapsulate i-g-t's implicit
  *   control flow.  Pick the most suitable one to have as much debug output as
- *   possible without polluting the code unecessarily. For example
+ *   possible without polluting the code unnecessarily. For example
  *   igt_assert_cmpint() for comparing integers or do_ioctl() for running ioctls
- *   and checking their results.  Feel free to add new ones to the libary or
+ *   and checking their results.  Feel free to add new ones to the library or
  *   wrap up a set of checks into a private function to further condense your
  *   test logic.
  *
@@ -197,7 +197,7 @@
  * run as non-root and doesn't require the i915 driver to be loaded (or any
  * intel gpu to be present). Then individual subtests can be run with
  * "--run-subtest". Usage help for tests with subtests can be obtained with the
- * "--help" commandline option.
+ * "--help" command line option.
  */
 
 static unsigned int exit_handler_count;
@@ -733,7 +733,7 @@ void __igt_skip_check(const char *file, const int line,
 /**
  * igt_success:
  *
- * Complete a (subtest) as successfull
+ * Complete a (subtest) as successful
  *
  * This bails out of a subtests and marks it as successful. For global tests it
  * it won't bail out of anything.
@@ -1041,9 +1041,9 @@ bool __igt_fork(void)
  * Wait for all children forked with igt_fork.
  *
  * The magic here is that exit codes from children will be correctly propagated
- * to the main thread, including the relevant exitcode if a child thread failed.
- * Of course if multiple children failed with differen exitcodes the resulting
- * exitcode will be non-deterministic.
+ * to the main thread, including the relevant exit code if a child thread failed.
+ * Of course if multiple children failed with different exit codes the resulting
+ * exit code will be non-deterministic.
  *
  * Note that igt_skip() will not be forwarded, feature tests need to be done
  * before spawning threads with igt_fork().
@@ -1282,8 +1282,8 @@ void igt_enable_exit_handler(void)
  * igt_run_in_simulation:
  *
  * This function can be used to select a reduced test set when running in
- * simulation enviroments. This i-g-t mode is selected by setting the
- * INTEL_SIMULATION enviroment variable to 1.
+ * simulation environments. This i-g-t mode is selected by setting the
+ * INTEL_SIMULATION environment variable to 1.
  *
  * Returns: True when run in simulation mode, false otherwise.
  */
@@ -1334,7 +1334,7 @@ void igt_skip_on_simulation(void)
  * to stderr and the test runner should treat this as an intermediate result
  * between SUCESS and FAILURE.
  *
- * The log level can be set through the IGT_LOG_LEVEL enviroment variable with
+ * The log level can be set through the IGT_LOG_LEVEL environment variable with
  * values "debug", "info", "warn" and "none". By default verbose debug message
  * are disabled. "none" completely disables all output and is not recommended
  * since crucial issues only reported at the IGT_LOG_WARN level are ignored.
lib/igt_core.h +2 -2
index d74cbf9..1e7bac8 100644
@@ -118,7 +118,7 @@ bool __igt_run_subtest(const char *subtest_name);
  * @name: name of the subtest
  *
  * This is a magic control flow block which denotes a subtest code block. Within
- * that codeblock igt_skip|success will only bail out of the subtest. The _f
+ * that code block igt_skip|success will only bail out of the subtest. The _f
  * variant accepts a printf format string, which is useful for constructing
  * combinatorial tests.
  *
@@ -140,7 +140,7 @@ bool __igt_run_subtest(const char *subtest_name);
  * @...: format string and optional arguments
  *
  * This is a magic control flow block which denotes a subtest code block. Within
- * that codeblock igt_skip|success will only bail out of the subtest. The _f
+ * that code block igt_skip|success will only bail out of the subtest. The _f
  * variant accepts a printf format string, which is useful for constructing
  * combinatorial tests.
  *
lib/igt_debugfs.c +3 -3
index 387ffbf..b30f5e4 100644
@@ -51,7 +51,7 @@
  * # Pipe CRC Support
  *
  * This library wraps up the kernel's support for capturing pipe CRCs into a
- * neat and tidy package. For the datailed usage see all the functions which
+ * neat and tidy package. For the detailed usage see all the functions which
  * work on #igt_pipe_crc_t. This is supported on all platforms and outputs.
  *
  * Actually using pipe CRCs to write modeset tests is a bit tricky though, so
@@ -59,7 +59,7 @@
  * blending, color correction and other hardware and how exactly the CRC is
  * computed at each tap point vary by hardware generation and are not disclosed.
  *
- * The only way to use #igt_crc_t CRCs therefors is to compare CRCs among each
+ * The only way to use #igt_crc_t CRCs therefore is to compare CRCs among each
  * another either for equality or difference. Otherwise CRCs must be treated as
  * completely opaque values. Note that not even CRCs from different pipes or tap
  * points on the same platform can be compared. Hence only use igt_crc_is_null()
@@ -218,7 +218,7 @@ bool igt_crc_is_null(igt_crc_t *crc)
  *
  * Compares two CRC values.
  *
- * Returns: Retruns true if the two CRCs match, false otherwise.
+ * Returns: true if the two CRCs match, false otherwise.
  */
 bool igt_crc_equal(igt_crc_t *a, igt_crc_t *b)
 {
lib/igt_debugfs.h +1 -1
index 0b55477..adcf83b 100644
@@ -153,7 +153,7 @@ int igt_open_forcewake_handle(void);
  * @STOP_RING_RENDER: Render ring
  * @STOP_RING_BSD: Video encoding/decoding ring
  * @STOP_RING_BLT: Blitter ring
- * @STOP_RING_VEBOX: Video enchanment ring
+ * @STOP_RING_VEBOX: Video enhancement ring
  * @STOP_RING_ALL: All rings
  * @STOP_RING_ALLOW_ERRORS: Driver will not omit expected DRM_ERRORS
  * @STOP_RING_ALLOW_BAN: Driver will use context ban policy
lib/igt_kms.h +1 -1
index 027b4e0..6d05b00 100644
@@ -70,7 +70,7 @@ enum port {
  * kmstest_port_name:
  * @port: display plane
  *
- * Returns: String represnting @port, e.g. "A".
+ * Returns: String representing @port, e.g. "A".
  */
 #define kmstest_port_name(port) ((port) + 'A')
 
lib/intel_mmio.c +4 -4
index c95ae58..5ff1ec1 100644
@@ -53,12 +53,12 @@
  * @include: intel_io.h
  *
  * This library provides register I/O helpers in both a basic version and a more
- * fancy version which also handles forcewak and can optionally check registers
+ * fancy version which also handles forcewake and can optionally check registers
  * against a white-list. All register function are compatible. Hence the same
  * code can be used to decode registers with either of them, or also from a dump
  * file using intel_mmio_use_dump_file().
  *
- * Futhermore this library also provides helper functions for accessing the
+ * Furthermore this library also provides helper functions for accessing the
  * various sideband interfaces found on Valleyview/Baytrail based platforms.
  */
 
@@ -84,7 +84,7 @@ static struct _mmio_data {
  * @file: name of the register dump file to open
  *
  * Sets up #mmio to point at the data contained in @file. This allows the same
- * code to get reused for dumping and decoding from running hardwared as from
+ * code to get reused for dumping and decoding from running hardware as from
  * register dumps.
  */
 void
@@ -109,7 +109,7 @@ intel_mmio_use_dump_file(char *file)
  * @pci_dev: intel gracphis pci device
  *
  * Sets up #mmio to point at the data contained in @file. This allows the same
- * code to get reused for dumping and decoding from running hardwared as from
+ * code to get reused for dumping and decoding from running hardware as from
  * register dumps.
  *
  * @pci_dev can be obtained from intel_get_pci_device().
lib/intel_os.c +1 -1
index 538327a..c8793b9 100644
@@ -200,7 +200,7 @@ intel_get_total_swap_mb(void)
  *
  * Computes the total amount of memory required to allocate @count surfaces,
  * each of @size bytes, and includes an estimate for kernel overhead. It then
- * queries the kernel for the avilable amount of memory on the system (either
+ * queries the kernel for the available amount of memory on the system (either
  * RAM and/or SWAP depending upon @mode) and determines whether there is
  * sufficient to run the test.
  *
lib/ioctl_wrappers.c +10 -10
index 39afc87..ab1a82e 100644
@@ -506,7 +506,7 @@ void *gem_mmap__cpu(int fd, uint32_t handle, int size, int prot)
  * object is in need again it must be set back to WILLNEED before first use.
  *
  * Returns: When setting the madvise state to WILLNEED this returns whether the
- * backing storage was still avialable or not.
+ * backing storage was still available or not.
  */
 int gem_madvise(int fd, uint32_t handle, int state)
 {
@@ -597,7 +597,7 @@ bool gem_bo_busy(int fd, uint32_t handle)
  * Feature test macro to check whether the kernel internally uses ppgtt to
  * execute batches. The /aliasing/ in the function name is a bit a misnomer,
  * this driver parameter is also true when full ppgtt address spaces are
- * availabel since for batchbuffer construction only ppgtt or global gtt is
+ * available since for batchbuffer construction only ppgtt or global gtt is
  * relevant.
  *
  * Returns: Whether batches are run through ppgtt.
@@ -623,7 +623,7 @@ bool gem_uses_aliasing_ppgtt(int fd)
  * @fd: open i915 drm file descriptor
  *
  * Feature test macro to query the kernel for the number of available fences
- * useable in a batchbuffer. Only relevant for pre-gen4.
+ * usable in a batchbuffer. Only relevant for pre-gen4.
  *
  * Returns: The number of available fences.
  */
@@ -663,7 +663,7 @@ bool gem_has_llc(int fd)
  * gem_get_num_rings:
  * @fd: open i915 drm file descriptor
  *
- * Feature test macro to query the number of avaible rings. This is useful in
+ * Feature test macro to query the number of available rings. This is useful in
  * test loops which need to step through all rings and similar logic.
  *
  * For more explicit tests of ring availability see gem_has_enable_ring() and
@@ -702,7 +702,7 @@ skip:
  *
  * Feature test macro to query whether a specific ring is available.
  *
- * Returns: Whether the ring is avaible or not.
+ * Returns: Whether the ring is available or not.
  */
 bool gem_has_enable_ring(int fd,int param)
 {
@@ -729,7 +729,7 @@ bool gem_has_enable_ring(int fd,int param)
  *
  * Note that recent Bspec calls this the VCS ring for Video Command Submission.
  *
- * Returns: Whether the BSD ring is avaible or not.
+ * Returns: Whether the BSD ring is available or not.
  */
 bool gem_has_bsd(int fd)
 {
@@ -745,7 +745,7 @@ bool gem_has_bsd(int fd)
  *
  * Note that recent Bspec calls this the BCS ring for Blitter Command Submission.
  *
- * Returns: Whether the blitter ring is avaible or not.
+ * Returns: Whether the blitter ring is available or not.
  */
 bool gem_has_blt(int fd)
 {
@@ -763,7 +763,7 @@ bool gem_has_blt(int fd)
  * Note that recent Bspec calls this the VECS ring for Video Enhancement Command
  * Submission.
  *
- * Returns: Whether the vebox ring is avaible or not.
+ * Returns: Whether the vebox ring is available or not.
  */
 bool gem_has_vebox(int fd)
 {
@@ -775,7 +775,7 @@ bool gem_has_vebox(int fd)
  * @fd: open i915 drm file descriptor
  *
  * Feature test macro to query the kernel for the available gpu aperture size
- * useable in a batchbuffer.
+ * usable in a batchbuffer.
  *
  * Returns: The available gtt address space size.
  */
@@ -814,7 +814,7 @@ uint64_t gem_aperture_size(int fd)
  * @fd: open i915 drm file descriptor
  *
  * Feature test macro to query the kernel for the mappable gpu aperture size.
- * This is the area avaialble for GTT memory mappings.
+ * This is the area available for GTT memory mappings.
  *
  * Returns: The mappable gtt address space size.
  */
Signature · 1 line
2.1.0
#2 lore raw

PATCH 3/4 lib: ensure any buffers are flushed before fork

In reply to Thomas Wood

Flush any buffers before forking to prevent duplicated output.

---
 lib/igt_core.c | 7 +++++++
 1 file changed, 7 insertions(+)
lib/igt_core.c +7 -0
index f2b4560..6e1c51a 100644
@@ -928,6 +928,10 @@ bool __igt_fork_helper(struct igt_helper_process *proc)
 	 */
 	tmp_count = exit_handler_count;
 	exit_handler_count = 0;
+
+	/* ensure any buffers are flushed before fork */
+	fflush(NULL);
+
 	switch (pid = fork()) {
 	case -1:
 		exit_handler_count = tmp_count;
@@ -1019,6 +1023,9 @@ bool __igt_fork(void)
 		igt_assert(test_children);
 	}
 
+	/* ensure any buffers are flushed before fork */
+	fflush(NULL);
+
 	switch (test_children[num_test_children++] = fork()) {
 	case -1:
 		igt_assert(0);
Signature · 1 line
2.1.0
#3 lore raw

PATCH 4/4 tests/sysfs_l3_parity: fix warnings in test enumeration

In reply to Thomas Wood

Source drm_lib.sh before skipping the test to ensure that subtest enumeration is always handled correctly.

---
 tests/sysfs_l3_parity | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/sysfs_l3_parity +3 -3
index e9d4411..9bd1724 100755
@@ -1,13 +1,13 @@
 #!/bin/bash
 
+SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
+. $SOURCE_DIR/drm_lib.sh
+
 if ! find /sys/class/drm/card*/ | grep l3_parity > /dev/null ; then
 	echo "no l3_parity interface, skipping test"
 	exit 77
 fi
 
-SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
-. $SOURCE_DIR/drm_lib.sh
-
 $SOURCE_DIR/../tools/intel_l3_parity -r 0 -b 0 -s 0 -e
 
 #Check that we can remap a row
Signature · 1 line
2.1.0
#4 lore raw
In reply to Thomas Wood
Quoted 10 lines · Thomas Wood
---
 tests/kms_flip.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/kms_flip.c +0 -0
index 3d3aa9b..8551f64 100644

tests/kms_flip.c static unsigned int run_test_step(struct test_output *o) · line 891

Quoted 8 lines
tests/kms_flip.c +4 -1
@@ -885,7 +885,10 @@ static unsigned int run_test_step(struct test_output *o)
 		join_vblank_wait_thread();
 	}
 
-	igt_info("."); fflush(stdout);
+	if (isatty(STDOUT_FILENO)) {
+		igt_info(".");
+		fflush(stdout);
+	}

Hm, igt_interactive_info() to wrap this?
-Daniel

Quoted 10 lines
tests/kms_flip.c +0 -0
 	if (do_flip && (o->flags & TEST_HANG)) {
 		hang = hang_gpu(drm_fd);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#5 lore raw

PATCH 1/1 lib: add a function to indicate activity

---
 lib/igt_aux.c              | 15 +++++++++++++++
 lib/igt_aux.h              |  1 +
 tests/kms_cursor_crc.c     |  3 ++-
 tests/kms_fence_pin_leak.c |  4 ++--
 tests/kms_flip.c           |  2 +-
 5 files changed, 21 insertions(+), 4 deletions(-)
lib/igt_aux.c +15 -0
index c0ea0e2..7c07b7d 100644
@@ -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;
lib/igt_aux.h +1 -0
index d958abe..d74bb8c 100644
@@ -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);
tests/kms_cursor_crc.c +2 -1
index c348d7a..c6f0fe4 100644
@@ -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);
tests/kms_fence_pin_leak.c +2 -2
index 69f36b8..fe2a038 100644
@@ -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);
tests/kms_flip.c +1 -1
index 3d3aa9b..adf5a28 100644
@@ -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);
Signature · 1 line
2.1.0