PATCH: Enhance DejaGNU result reader

Mark Mitchell mark at codesourcery.com
Mon Oct 24 07:44:25 UTC 2005


QMTest has had a ResultReader that could parse DejaGNU .log files for
some time.  This patch enhances that reader in two respects.

First, the reader now offers a "combined" mode.  DejaGNU often applies
multiple separate tests in situations which QMTest would probably group
together into a single test.  For example, here's an extra from a
DejaGNU log file for G++:

FAIL: g++.dg/other/switch2.C  (test for errors, line 16)
FAIL: g++.dg/other/switch2.C  (test for errors, line 17)
FAIL: g++.dg/other/switch2.C  (test for errors, line 18)
FAIL: g++.dg/other/switch2.C  (test for errors, line 19)
FAIL: g++.dg/other/switch2.C  (test for errors, line 20)
PASS: g++.dg/other/switch2.C (test for excess errors)

All that comes from source file, which the compiler is supposed to
compile.  DejaGNU is checking that errors appear on the lines where they
should, and that no additional errors appear.  In QMTest, it would be
natural to have a test class that compiled the file, and PASSed only if
all of the right things happened, and failed otherwise, because most
people talk about "the test switch2.C", not "the test
switch2.C-errors-on-line-16".

Until now, the DejaGNU reader only let you read in results in the
DejaGNU model, so that the above would be six separate results.  That
mode is still present, but the new "combined" mode combines the DejaGNU
results into a single result:

  g++.dg/other/switch2.C                        : FAIL

    Test for errors, line 16. Test for errors, line 17. Test for errors,
    line 18. Test for errors, line 19. Test for errors, line 20.

The second enhancement is a "generate-expectations" mode.  DejaGNU
stores information about expected passage and failure in the testsuite
itself, rather than using QMTest's "todays results are tomorrows
expectations" approach.  In order to provide an analog, in the
generate-expectations mode, the results generated by QMTest reflect not
the actual reuslts in the DejaGNU .log file, but the DejaGNU
expectations for those results.  So, a command like:

  qmtest summarize \
    -O "dejagnu_stream.DejaGNUReader(filename = 'gcc.log', \
                                     expectations = 'true')" \
    gcc.log

will show the same unexpected failures in QMTest as would be shown by
DejaGNU, if 'gcc.log' is a DejaGNU log file.

(Note that here we're using the extension descriptor syntax to construct
a result readers for the expected outcomes, using a non-default
argument, while for the principal input we're content to use the default
mode.)

-- 
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
(916) 791-8304
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: qmtest.patch
URL: <http://sourcerytools.com/pipermail/qmtest/attachments/20051024/06db4a21/attachment.ksh>


More information about the qmtest mailing list