Thanks a lot. That is exactly what I was looking for!

K

On Wed, Sep 28, 2011 at 2:49 PM, Richard Guenther
<richard.guent...@gmail.com> wrote:
> On Wed, Sep 28, 2011 at 12:18 PM, Kirill Yukhin <kirill.yuk...@gmail.com> 
> wrote:
>> Hi folks,
>> I have a question. For DejaGNU we have only one option for each test.
>>
>> It may be e.g. either "dg-do" compile or "dg-do run". This is really
>> not as suitable
>>
>> For instance, we cheking some new instructio autogeneration. We have
>> to do 2 tests:
>>  1. We have to write some routine which will contain a pattern which
>> will be generated as desired instruction. And check at runtime if that
>> was done correctly, comparing to some expected result. We use "dg-do
>> run here"
>>  2. Next we have to check that instruction really is auto generated,
>> so we use "scan-assembler" for that source.
>>
>> May question is: am I missed something? Is there an opportunity to
>> store to tests into single file? If no, why we do not have one?
>
> Add -save-temps via dg-options, then you can use dg-scan-assembler.
>
>> Here is reduced example (from gcc.target/i386):
>> 1.
>> /* run.c */
>> /* { dg-do run } */
>>
>> int
>> auto_gen_insn(args...)
>> {
>>  /* Code to auto-gen instruction. */
>>  return result;
>> }
>>
>> int
>> check_semantic(args...)
>> {
>>  /* Code to do the same, but without desired insn. */
>>  return result
>> }
>>
>> int
>> main ()
>> {
>>  if( auto_gen_insn(args...) != check_semantic(args...) )
>>    abort ();
>> }
>>
>> 2.
>> /* check_gen.c */
>> /* { dg-do compile } */
>> #include "run.c"
>> /* { dg-final { scan-assembler-times "insn" 1 } } */
>>
>> --
>> Thanks, k
>>
>

Reply via email to