[Intel-gfx] [PATCH v2] tests/gem_error_capture: Initial testcase for error state capture/dump

Mateo Lozano, Oscar oscar.mateo at intel.com
Fri May 9 14:04:47 CEST 2014


Hi Mika,

> > +static bool rings_stopped(void)
> > +{
> > +	int fd;
> > +	static char buf[128];
> > +	unsigned long long val;
> > +
> > +	fd = igt_debugfs_open("i915_ring_stop", O_RDONLY);
> > +	igt_assert(fd >= 0);
> > +
> > +	igt_assert(read(fd, buf, sizeof(buf)) > 0);
> > +	close(fd);
> > +
> > +	sscanf(buf, "%llx", &val);
> > +
> > +	return (bool)val;
> > +}
> 
> Please use igt_set_stop_rings() and igt_get_stop_rings().
> 
> Also consider stopping only the ring you are testing for.

Oops, I didn see these before. Ok, done in the new version.

> > +			for (i = 0; i < tail / 4; i++) {
> > +				igt_assert(getline(&line, &line_size, file) > 0);
> > +				items = sscanf(line, "%08x :  %08x\n",
> > +						&offset, &command);
> > +				igt_assert(items == 2);
> > +				if ((command & 0x1F800000) == MI_BATCH_BUFFER_START) {
> > +					igt_assert(getline(&line, &line_size, file) > 0);
> > +					items = sscanf(line, "%08x :  %08x\n",
> > +							&offset, &expected_addr);
> > +					igt_assert(items == 2);
> 
> Should check for MAGIC_NUMBER here?

I'm doing it above already, inside bb_matched:

			for (i = 0; i < sizeof(batch) / 4; i++) {
				igt_assert(getline(&line, &line_size, file) > 0);
				snprintf(expected_line, sizeof(expected_line), "%08x :  %08x",
						4*i, batch[i]);
				igt_assert(strstr(line, expected_line));
			}

-- Oscar


More information about the Intel-gfx mailing list