Commit 91442c20 by Janis Johnson Committed by Janis Johnson

README: Describe tests in source directory.

	* gcc.test-framework/README: Describe tests in source directory.
	* gcc.test-framework/test-framework.awk: Handle dg- tests.
	* gcc.test-framework/test-framework.exp: Handle dg- tests.
	* gcc.test-framework/dg-bogus-exp-P.c: New test.
	* gcc.test-framework/dg-bogus-exp-XF.c: New test.
	* gcc.test-framework/dg-do-assemble-exp-P.c: New test.
	* gcc.test-framework/dg-do-compile-exp-P.c: New test.
	* gcc.test-framework/dg-do-link-exp-P.c: New test.
	* gcc.test-framework/dg-do-run-exp-P.c: New test.
	* gcc.test-framework/dg-dot-run-exp-P.c: New test.
	* gcc.test-framework/dg-dot-run-exp-U.c: New test.
	* gcc.test-framework/dg-dox-run-exp-XF.c: New test.
	* gcc.test-framework/dg-error-exp-P.c: New test.
	* gcc.test-framework/dg-error-exp-XP.c: New test.
	* gcc.test-framework/dg-excess-errors-exp-XF.c: New test.
	* gcc.test-framework/dg-excess-errors-exp-XP.c: New test.
	* gcc.test-framework/dg-output-exp-P.c: New test.
	* gcc.test-framework/dg-output-exp-XF.c: New test.
	* gcc.test-framework/dg-warning-exp-P.c: New test.
	* gcc.misc-tests/dg-1.c: Remove.
	* gcc.misc-tests/dg-2.c: Remove.
	* gcc.misc-tests/dg-3.c: Remove.
	* gcc.misc-tests/dg-4.c: Remove.
	* gcc.misc-tests/dg-5.c: Remove.
	* gcc.misc-tests/dg-6.c: Remove.
	* gcc.misc-tests/dg-7.c: Remove.
	* gcc.misc-tests/dg-8.c: Remove.
	* gcc.misc-tests/dg-9.c: Remove.
	* gcc.misc-tests/dg-10.c: Remove.
	* gcc.misc-tests/dg-11.c: Remove.
	* gcc.misc-tests/dg-12.c: Remove.
	* gcc.misc-tests/dg-test.exp: Remove.

From-SVN: r94550
parent 0e7eed46
2005-02-01 Janis Johnson <janis187@us.ibm.com> 2005-02-01 Janis Johnson <janis187@us.ibm.com>
* gcc.test-framework/README: Describe tests in source directory.
* gcc.test-framework/test-framework.awk: Handle dg- tests.
* gcc.test-framework/test-framework.exp: Handle dg- tests.
* gcc.test-framework/dg-bogus-exp-P.c: New test.
* gcc.test-framework/dg-bogus-exp-XF.c: New test.
* gcc.test-framework/dg-do-assemble-exp-P.c: New test.
* gcc.test-framework/dg-do-compile-exp-P.c: New test.
* gcc.test-framework/dg-do-link-exp-P.c: New test.
* gcc.test-framework/dg-do-run-exp-P.c: New test.
* gcc.test-framework/dg-dot-run-exp-P.c: New test.
* gcc.test-framework/dg-dot-run-exp-U.c: New test.
* gcc.test-framework/dg-dox-run-exp-XF.c: New test.
* gcc.test-framework/dg-error-exp-P.c: New test.
* gcc.test-framework/dg-error-exp-XP.c: New test.
* gcc.test-framework/dg-excess-errors-exp-XF.c: New test.
* gcc.test-framework/dg-excess-errors-exp-XP.c: New test.
* gcc.test-framework/dg-output-exp-P.c: New test.
* gcc.test-framework/dg-output-exp-XF.c: New test.
* gcc.test-framework/dg-warning-exp-P.c: New test.
* gcc.misc-tests/dg-1.c: Remove.
* gcc.misc-tests/dg-2.c: Remove.
* gcc.misc-tests/dg-3.c: Remove.
* gcc.misc-tests/dg-4.c: Remove.
* gcc.misc-tests/dg-5.c: Remove.
* gcc.misc-tests/dg-6.c: Remove.
* gcc.misc-tests/dg-7.c: Remove.
* gcc.misc-tests/dg-8.c: Remove.
* gcc.misc-tests/dg-9.c: Remove.
* gcc.misc-tests/dg-10.c: Remove.
* gcc.misc-tests/dg-11.c: Remove.
* gcc.misc-tests/dg-12.c: Remove.
* gcc.misc-tests/dg-test.exp: Remove.
* gcc.test-framework/test-framework.awk: Change recording and * gcc.test-framework/test-framework.awk: Change recording and
printing of passes and failures. printing of passes and failures.
......
/* Test the tester. */
/* { dg-prms-id 42 } */
/* { dg-do compile } */
main () { return 0; }
/* { dg-final { if ![file exists dg-1.s] { fail "dg-1.c (compile)"; return; } } } */
/* { dg-final { set tmp [grep dg-1.s main line] } } */
/* { dg-final { if ![string match "" $tmp] \{ } } */
/* { dg-final { pass "dg-1.c (main function present)" } } */
/* { dg-final { \} else \{ } } */
/* { dg-final { fail "dg-1.c (main function not present)" } } */
/* { dg-final { \} } } */
# Copyright (C) 1997 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Test the dg.exp driver.
# This is a testsuite tester tester. As such we *want* to test things like
# expected failure handling. But expected failures must continually be
# monitored and so in the normal case we create unnecessary work. So only
# run these tests if DG_TEST is defined to "yes".
global DG_TEST
if { ![info exists DG_TEST] || "$DG_TEST" != "yes" } {
return
}
# Load support procs.
load_lib gcc-dg.exp
# Initialize harness.
dg-init
# Main loop.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dg-*.c]] "" ""
# All done.
dg-finish
Check the test directives used in GCC's testsuite by generating and Check the test directives used in GCC's testsuite by generating and
running tests that use combinations of those commands or that stress running tests that use combinations of those commands or that stress
the selector expressions that can be used in those directives. the selector expressions that can be used in those directives. Also
run a few tests of specific functionality from the source directory.
Each test has two parts: a file ending in "-1.c" whose expected result Each generated test has two parts: a file ending in "-1.c" whose
is encoded in the filename after "-exp-", and a file ending in "-2.c" expected result is encoded in the filename after "-exp-", and a file
which is always expected to pass. ending in "-2.c" which is always expected to pass.
This test directory is normally skipped and is not meant to be run at This test directory is normally skipped and is not meant to be run at
the same time as other parts of the testsuite; it's only of interest to the same time as other parts of the testsuite; it's only of interest to
...@@ -21,4 +22,4 @@ To check the results: ...@@ -21,4 +22,4 @@ To check the results:
awk -f ${TF}/test-framework.awk gcc/testsuite/gcc.sum awk -f ${TF}/test-framework.awk gcc/testsuite/gcc.sum
The awk script prints unexpected results followed by the number of tests The awk script prints unexpected results followed by the number of tests
that passed. that passed and failed.
/* Test the tester; previously part of gcc.misc-tests/dg-9.c. */
/* { dg-prms-id 42 } */
/* { dg-options "-Wall" } */
int main (int argc, char *argv[])
{
return 0; /* { dg-bogus "foobar" "bogus fail test" } */
}
/* Test the tester; previously part of gcc.misc-tests/dg-9.c. */
/* { dg-prms-id 42 } */
/* { dg-options "-Wall" } */
main (int argc, char *argv[])
{ /* { dg-bogus "return type" "bogus pass test" { xfail *-*-* } } */
}
/* { dg-excess-errors "bogus pass test" { xfail *-*-* } } */
/* Test the tester. */ /* Test the tester; previously gcc.misc-tests/dg-2.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-do assemble } */ /* { dg-do assemble } */
main () { return 0; } main () { return 0; }
/* { dg-final { if [file exists dg-2.o] \{ } } */ /* { dg-final { if [file exists dg-do-assemble-exp-P.o] \{ } } */
/* { dg-final { pass "dg-2.c (assemble: produce .o test)" } } */ /* { dg-final { pass "dg-do-assemble-exp-P.c (assemble: produce .o test)" } } */
/* { dg-final { \} else \{ } } */ /* { dg-final { \} else \{ } } */
/* { dg-final { fail "dg-2.c (assemble: produce .o test)" } } */ /* { dg-final { fail "dg-do-assemble-exp-P.c (assemble: produce .o test)" } } */
/* { dg-final { \} } } */ /* { dg-final { \} } } */
/* Test the tester; previously gcc.misc-tests/dg-1.c. */
/* { dg-prms-id 42 } */
/* { dg-do compile } */
main () { return 0; }
/* { dg-final { if ![file exists dg-do-compile-exp-P.s] { fail "dg-do-compile-exp-P.c (compile)"; return; } } } */
/* { dg-final { set tmp [grep dg-do-compile-exp-P.s main line] } } */
/* { dg-final { if ![string match "" $tmp] \{ } } */
/* { dg-final { pass "dg-do-compile-exp-P.c (main function present)" } } */
/* { dg-final { \} else \{ } } */
/* { dg-final { fail "dg-do-compile-exp-P.c (main function not present)" } } */
/* { dg-final { \} } } */
/* Test the tester. */ /* Test the tester; previously gcc.misc-tests/dg-3.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-do link } */ /* { dg-do link } */
main () { return 0; } main () { return 0; }
/* { dg-final { if [file exists a.out] \{ } } */ /* { dg-final { if [file exists dg-do-link-exp-P.exe] \{ } } */
/* { dg-final { pass "dg-2.c (link: produce a.out test)" } } */ /* { dg-final { pass "dg-do-link-exp-P.c (link: produce a.out test)" } } */
/* { dg-final { \} else \{ } } */ /* { dg-final { \} else \{ } } */
/* { dg-final { fail "dg-2.c (link: produce a.out test)" } } */ /* { dg-final { fail "dg-do-link-exp-P.c (link: produce a.out test)" } } */
/* { dg-final { \} } } */ /* { dg-final { \} } } */
/* Test the tester. */ /* Test the tester; previously gcc.misc-tests/dg-4.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-do run } */ /* { dg-do run } */
......
/* Test the tester. */ /* Test the tester; previously gcc.misc-tests/dg-11.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-do run { target sparc-sun-solaris2* } } */ /* { dg-do run { target *-*-* } } */
/* The \n is left out of the pattern because tcl's exec will remove it. */ /* The \n is left out of the pattern because tcl's exec will remove it. */
/* { dg-output {Hello world[.]} } */ /* { dg-output {Hello world[.]} } */
......
/* Test the tester. */ /* Test the tester; previously gcc.misc-tests/dg-12.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-do run { target foo-bar-eh } } */ /* { dg-do run { target foo-bar-eh } } */
/* The \n is left out of the pattern because tcl's exec will remove it. */ /* The \n is left out of the pattern because tcl's exec will remove it. */
......
/* Test the tester. */ /* Test the tester; previously gcc.misc-tests/dg-7.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-do run { xfail *-*-* } } */ /* { dg-do run { xfail *-*-* } } */
extern void abort (void); extern void abort (void);
......
/* Test the tester. */ /* Test the tester; previously part of gcc.misc-tests/dg-9.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-options "-Wall" } */ /* { dg-options "-Wall" } */
/* FIXME: we want to test dg-lose here. Anyone know of a good way to int main (int argc, char *argv[])
crash the compiler? */
int
main (int argc, char *argv[])
{ {
+; /* { dg-error "syntax error" "error test" } */
return 0; return 0;
} }
/* Test the tester; previously part of gcc.misc-tests/dg-9.c. */
/* { dg-prms-id 42 } */
/* { dg-options "-Wall" } */
int main (int argc, char *argv[])
{
+;
/* { dg-error "syntax error" "error test" { xfail *-*-* } 7 } */
return 0;
}
/* { dg-excess-errors "expect failure" { xfail *-*-* } } */
/* Test the tester. */ /* Test the tester; previously gcc.misc-tests/dg-8.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-options "-Wall" } */ /* { dg-options "-Wall" } */
/* { dg-do run } */ /* { dg-do compile } */
/* { dg-excess-errors "excess errors" } */ /* { dg-excess-errors "excess errors" } */
/* should get warning about defaulting return type - excess error */ /* should get warning about defaulting return type - excess error */
......
/* Test the tester. */
/* { dg-prms-id 42 } */
/* { dg-options "-Wall" } */
/* { dg-do compile } */
/* { dg-excess-errors "excess errors" } */
/* No messages, so unexpected pass. */
int main () { return 0; }
/* Test the tester. */ /* Test the tester; previously gcc.misc-tests/dg-5.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-do run } */ /* { dg-do run } */
/* The \n is left out of the pattern because tcl's exec will remove it. */ /* The \n is left out of the pattern because tcl's exec will remove it. */
......
/* Test the tester. */ /* Test the tester; previously gcc.misc-tests/dg-6.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-do run { target *-*-* } } */ /* { dg-do run { target *-*-* } } */
/* The \n is left out of the pattern because tcl's exec will remove it. */ /* The \n is left out of the pattern because tcl's exec will remove it. */
......
/* Test the tester. */ /* Test the tester; previously part of gcc.misc-tests/dg-9.c. */
/* { dg-prms-id 42 } */ /* { dg-prms-id 42 } */
/* { dg-options "-Wall" } */ /* { dg-options "-Wall" } */
...@@ -8,8 +8,4 @@ f () ...@@ -8,8 +8,4 @@ f ()
main (int argc, char *argv[]) main (int argc, char *argv[])
{ /* { dg-warning "return type" "warning test" } */ { /* { dg-warning "return type" "warning test" } */
+; /* { dg-error "parse" "error test" } */
/* { dg-bogus "foobar" "bogus fail test" } */
return a; /* { dg-bogus "undeclared|identifier|appears" "bogus pass test" { xfail *-*-* } } */
} /* { dg-warning "control reaches end" "warning test" } */ } /* { dg-warning "control reaches end" "warning test" } */
...@@ -47,6 +47,10 @@ BEGIN { skip = 1; passes = 0; fails = 0; } ...@@ -47,6 +47,10 @@ BEGIN { skip = 1; passes = 0; fails = 0; }
/^PASS.*dox.*(test for excess errors)/ { ignore(); next } /^PASS.*dox.*(test for excess errors)/ { ignore(); next }
# Ignore lines that begin with comma. # Ignore lines that begin with comma.
/^,/ { ignore(); next } /^,/ { ignore(); next }
# For tests of dg-output, ignore successful compilation.
/^PASS.*dg-output.*(test for excess error)/ { ignore(); next }
# For tests of dg-output, ignore successful execution.
/^PASS.*dg-output.*execution test/ { ignore(); next }
/^PASS/ { if (match ($0, "exp-P")) { pass(); next } } /^PASS/ { if (match ($0, "exp-P")) { pass(); next } }
/^FAIL/ { if (match ($0, "exp-F")) { pass(); next } } /^FAIL/ { if (match ($0, "exp-F")) { pass(); next } }
/^XPASS/ { if (match ($0, "exp-XP")) { pass(); next } } /^XPASS/ { if (match ($0, "exp-XP")) { pass(); next } }
......
...@@ -46,8 +46,12 @@ global dg-do-what-default ...@@ -46,8 +46,12 @@ global dg-do-what-default
set save-dg-do-what-default ${dg-do-what-default} set save-dg-do-what-default ${dg-do-what-default}
set dg-do-what-default compile set dg-do-what-default compile
# Generate the tests. dg-init
# Run tests from the source directory.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dg-*.c]] "" ""
# Generate additional tests.
set tstobjdir "$tmpdir/gcc.test-framework" set tstobjdir "$tmpdir/gcc.test-framework"
set generator "$srcdir/$subdir/gen_directive_tests" set generator "$srcdir/$subdir/gen_directive_tests"
file delete -force $tstobjdir file delete -force $tstobjdir
...@@ -55,12 +59,11 @@ file mkdir $tstobjdir ...@@ -55,12 +59,11 @@ file mkdir $tstobjdir
set status [remote_exec host "$generator $tstobjdir"] set status [remote_exec host "$generator $tstobjdir"]
set status [lindex $status 0] set status [lindex $status 0]
if { $status == 0 } { if { $status == 0 } {
# Run the tests. # Run the generated tests.
dg-init
dg-runtest [lsort [find $tstobjdir *.c]] "" "-DY1 -DY2" dg-runtest [lsort [find $tstobjdir *.c]] "" "-DY1 -DY2"
dg-finish
} else { } else {
warning "Could not generate test framework tests" warning "Could not generate test framework tests"
} }
dg-finish
set dg-do-what-default ${save-dg-do-what-default} set dg-do-what-default ${save-dg-do-what-default}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment