From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mateo Lozano, Oscar" Subject: Re: [PATCH v2] tests/gem_error_capture: Initial testcase for error state capture/dump Date: Fri, 9 May 2014 12:04:47 +0000 Message-ID: <1399636785.3469.3.camel@omateolo-linux2> References: <1397221193-12278-1-git-send-email-oscar.mateo@intel.com> <1397234892-13820-1-git-send-email-oscar.mateo@intel.com> <87mwfmodfj.fsf@gaia.fi.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 211246E4BE for ; Fri, 9 May 2014 05:07:11 -0700 (PDT) In-Reply-To: <87mwfmodfj.fsf@gaia.fi.intel.com> Content-Language: en-US Content-ID: <61387D7233F58F458DD8FA5766307B78@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Mika Kuoppala Cc: "intel-gfx@lists.freedesktop.org" List-Id: intel-gfx@lists.freedesktop.org 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