Signed-off-by: Thomas Wood <[email protected]>
---
 lib/igt_core.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index b98cb41..925d78c 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -366,6 +366,23 @@ static void low_mem_killer_disable(bool disable)
 }
 
 #define write_log_msg(x) write(STDERR_FILENO, x, strlen(x))
+static void clear_log(void)
+{
+       uint8_t i;
+
+       pthread_mutex_lock(&log_buffer_mutex);
+
+       i = 0;
+       do {
+               free(log_buffer.entries[i]);
+               log_buffer.entries[i] = NULL;
+               i++;
+       } while (i != 0);
+       log_buffer.start = 0;
+       log_buffer.end = 0;
+
+       pthread_mutex_unlock(&log_buffer_mutex);
+}
 
 /* this function must be safe to be called inside a signal handler */
 static void write_log(void)
@@ -409,6 +426,8 @@ static void write_log(void)
        write_log_msg("--- Log End\n");
 
        pthread_mutex_unlock(&log_buffer_mutex);
+
+       clear_log();
 }
 
 bool igt_exit_called;
@@ -761,6 +780,8 @@ bool __igt_run_subtest(const char *subtest_name)
                return false;
        }
 
+       clear_log();
+
        kmsg(KERN_INFO "%s: starting subtest %s\n", command_str, subtest_name);
 
        gettime(&subtest_time);
-- 
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to