public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Stan Cox <scox@redhat.com>
To: Frysk List <frysk@sourceware.org>
Subject: Re: generating type tests
Date: Thu, 18 Oct 2007 16:16:00 -0000	[thread overview]
Message-ID: <1192723754.2947.284.camel@multics.rdu.redhat.com> (raw)
In-Reply-To: <47139B3A.3000101@redhat.com>

I think this reworking implements the contract we discussed in the
meeting.  gen-type-funit-tests.py builds funit-type-expect.c with type
annotations of the form:
// Test: <name to be given to a "suite" (one test in expect parlance)>
// Name: <variable name>
// Value: <initial value of variable>
// Type: <type as specified in a source program>
// EType: <expanded type as if the typedef were expanded>
gen-type-expect-tests.py builds TestTypeEntry*.java from, for example
funit-type-expect.c, using the type annotations.  Multiple files can be
given so types can be specified standalone outside of the
gen-type-funit-tests.py framework.  This will result in
TestTypeEntry*.java having the form:
    public void testScalar () {
        Expect [] expect  = {...}
      ExpectTest expectTest = new ExpectTest("funit-type-entry");
      expectTest.compareEqual(expect, "testScalar ");
    }
    // testArray/testStruct/testEnum, all generated by 
    // gen-type-funit-tests.py
    public void testAlpha () {
        Expect [] expect  = {
            new Expect("char_var","char"),
        }
      ExpectTest expectTest = new ExpectTest("x");
      expectTest.compareEqual(expect, "testScalar ");
    }
testAlpha is generated from x.c via:
gen-type-expect-tests.py -type funit-type-entry.c x.c
from this x.c:
// Test: Alpha
static char char_var = 176;
// Name: char_var
// Value: 176
// Type: char
main (int argc, char **argv)
{}

The "Type" testing passes for those types currently being generated by
gen-type-funit*. Here is a run of TestRunner done with the assistance of
some makefile surgery.
Running testScalar(frysk.debuginfo.TestTypeEntry)
PASS
Running testArray(frysk.debuginfo.TestTypeEntry)
PASS
Running testStruct(frysk.debuginfo.TestTypeEntry)
PASS
Running testEnum(frysk.debuginfo.TestTypeEntry)
PASS

Time: 0.21

OK (4 tests)




      parent reply	other threads:[~2007-10-18 16:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-12 21:18 Stan Cox
2007-10-12 22:54 ` Andrew Cagney
2007-10-15  2:10   ` Stan Cox
2007-10-15 16:50     ` Andrew Cagney
2007-10-16 19:47       ` Stan Cox
2007-10-17 11:12         ` Stan Cox
2007-10-15 16:56 ` Andrew Cagney
2007-10-15 19:13   ` Stan Cox
2007-10-18 16:16   ` Stan Cox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1192723754.2947.284.camel@multics.rdu.redhat.com \
    --to=scox@redhat.com \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).