[Intel-gfx] [PATCH i-g-t 1/5] lib: print recent log output if a test fails

Chris Wilson chris at chris-wilson.co.uk
Wed Dec 17 09:44:58 PST 2014


On Wed, Dec 17, 2014 at 05:19:21PM +0000, Chris Wilson wrote:
> char *new, *old;
sigset_t block_signals, save_signals;
 
> asprintf(&new,
> 	 "(%s:%d) %s%s%s: %s",
> 	 program_name, getpid(),
> 	 (domain) ? domain : "",
> 	 (domain) ? "-" : "",
> 	 igt_log_level_str[level],
> 	 line);

sigfillset(&block_signals);
pthread_sigmask(SIG_SETMASK, &block_signals, &save_signals);
> 
> pthread_mutex_lock(&log_buffer_mutex);
> old = log_buffer.entries[log_buffer.end];
> log_bufffer.entries[log_buffer.end] = new;
> if (++log_buffer.end == log_buffer.start)
> 	log_buffer.start++;
> pthread_mutex_unlock(&log_buffer_mutex);

pthread_sigmask(SIG_SETMASK, &save_signals, NULL);
 
> free(old);

That will at least stop SIGARLM and friends firing whilst we poke around
inside log_buffer. It might make a test result unstable, but will
prevent that same instability from causing a lockup of igt.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list