diff options
author | janis <janis@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-01 17:37:25 +0000 |
---|---|---|
committer | janis <janis@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-01 17:37:25 +0000 |
commit | c7d010f2a6166ee00638f2eb0038150367e89b08 (patch) | |
tree | 9082927fe5de46b203efe64a06be20e624e63746 /gcc/testsuite/gcc.test-framework | |
parent | 09a47a06aa045085b494335a7db97d2d44c772dd (diff) | |
download | gcc-c7d010f2a6166ee00638f2eb0038150367e89b08.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94550 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.test-framework')
19 files changed, 166 insertions, 9 deletions
diff --git a/gcc/testsuite/gcc.test-framework/README b/gcc/testsuite/gcc.test-framework/README index 63fe9dc5515..3a9d4f086af 100644 --- a/gcc/testsuite/gcc.test-framework/README +++ b/gcc/testsuite/gcc.test-framework/README @@ -1,10 +1,11 @@ Check the test directives used in GCC's testsuite by generating and 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 -is encoded in the filename after "-exp-", and a file ending in "-2.c" -which is always expected to pass. +Each generated test has two parts: a file ending in "-1.c" whose +expected result is encoded in the filename after "-exp-", and a file +ending in "-2.c" which is always expected to pass. 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 @@ -21,4 +22,4 @@ To check the results: awk -f ${TF}/test-framework.awk gcc/testsuite/gcc.sum The awk script prints unexpected results followed by the number of tests -that passed. +that passed and failed. diff --git a/gcc/testsuite/gcc.test-framework/dg-bogus-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-bogus-exp-P.c new file mode 100644 index 00000000000..003264a72df --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-bogus-exp-P.c @@ -0,0 +1,8 @@ +/* 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" } */ +} diff --git a/gcc/testsuite/gcc.test-framework/dg-bogus-exp-XF.c b/gcc/testsuite/gcc.test-framework/dg-bogus-exp-XF.c new file mode 100644 index 00000000000..60c9147af6e --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-bogus-exp-XF.c @@ -0,0 +1,9 @@ +/* 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 *-*-* } } */ diff --git a/gcc/testsuite/gcc.test-framework/dg-do-assemble-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-do-assemble-exp-P.c new file mode 100644 index 00000000000..316572092a6 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-do-assemble-exp-P.c @@ -0,0 +1,11 @@ +/* Test the tester; previously gcc.misc-tests/dg-2.c. */ +/* { dg-prms-id 42 } */ +/* { dg-do assemble } */ + +main () { return 0; } + +/* { dg-final { if [file exists dg-do-assemble-exp-P.o] \{ } } */ +/* { dg-final { pass "dg-do-assemble-exp-P.c (assemble: produce .o test)" } } */ +/* { dg-final { \} else \{ } } */ +/* { dg-final { fail "dg-do-assemble-exp-P.c (assemble: produce .o test)" } } */ +/* { dg-final { \} } } */ diff --git a/gcc/testsuite/gcc.test-framework/dg-do-compile-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-do-compile-exp-P.c new file mode 100644 index 00000000000..93857465a16 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-do-compile-exp-P.c @@ -0,0 +1,14 @@ +/* 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 { \} } } */ diff --git a/gcc/testsuite/gcc.test-framework/dg-do-link-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-do-link-exp-P.c new file mode 100644 index 00000000000..254109e6526 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-do-link-exp-P.c @@ -0,0 +1,11 @@ +/* Test the tester; previously gcc.misc-tests/dg-3.c. */ +/* { dg-prms-id 42 } */ +/* { dg-do link } */ + +main () { return 0; } + +/* { dg-final { if [file exists dg-do-link-exp-P.exe] \{ } } */ +/* { dg-final { pass "dg-do-link-exp-P.c (link: produce a.out test)" } } */ +/* { dg-final { \} else \{ } } */ +/* { dg-final { fail "dg-do-link-exp-P.c (link: produce a.out test)" } } */ +/* { dg-final { \} } } */ diff --git a/gcc/testsuite/gcc.test-framework/dg-do-run-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-do-run-exp-P.c new file mode 100644 index 00000000000..a7f3ffa680a --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-do-run-exp-P.c @@ -0,0 +1,5 @@ +/* Test the tester; previously gcc.misc-tests/dg-4.c. */ +/* { dg-prms-id 42 } */ +/* { dg-do run } */ + +main () { return 0; } diff --git a/gcc/testsuite/gcc.test-framework/dg-dot-run-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-dot-run-exp-P.c new file mode 100644 index 00000000000..3bbc4e1bd40 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-dot-run-exp-P.c @@ -0,0 +1,9 @@ +/* Test the tester; previously gcc.misc-tests/dg-11.c. */ +/* { dg-prms-id 42 } */ +/* { dg-do run { target *-*-* } } */ +/* The \n is left out of the pattern because tcl's exec will remove it. */ +/* { dg-output {Hello world[.]} } */ + +#include <stdio.h> + +main () { printf ("Hello world.\n"); return 0; } diff --git a/gcc/testsuite/gcc.test-framework/dg-dot-run-exp-U.c b/gcc/testsuite/gcc.test-framework/dg-dot-run-exp-U.c new file mode 100644 index 00000000000..9d79604b226 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-dot-run-exp-U.c @@ -0,0 +1,9 @@ +/* Test the tester; previously gcc.misc-tests/dg-12.c. */ +/* { dg-prms-id 42 } */ +/* { dg-do run { target foo-bar-eh } } */ +/* The \n is left out of the pattern because tcl's exec will remove it. */ +/* { dg-output {Hello world[.]} } */ + +#include <stdio.h> + +main () { printf ("Hello world.\n"); return 0; } diff --git a/gcc/testsuite/gcc.test-framework/dg-dox-run-exp-XF.c b/gcc/testsuite/gcc.test-framework/dg-dox-run-exp-XF.c new file mode 100644 index 00000000000..69cff8bb8e3 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-dox-run-exp-XF.c @@ -0,0 +1,6 @@ +/* Test the tester; previously gcc.misc-tests/dg-7.c. */ +/* { dg-prms-id 42 } */ +/* { dg-do run { xfail *-*-* } } */ +extern void abort (void); + +main () { abort (); return 0; } diff --git a/gcc/testsuite/gcc.test-framework/dg-error-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-error-exp-P.c new file mode 100644 index 00000000000..cb28e34ce95 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-error-exp-P.c @@ -0,0 +1,9 @@ +/* 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" } */ + return 0; +} diff --git a/gcc/testsuite/gcc.test-framework/dg-error-exp-XP.c b/gcc/testsuite/gcc.test-framework/dg-error-exp-XP.c new file mode 100644 index 00000000000..856b7270b25 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-error-exp-XP.c @@ -0,0 +1,11 @@ +/* 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 *-*-* } } */ diff --git a/gcc/testsuite/gcc.test-framework/dg-excess-errors-exp-XF.c b/gcc/testsuite/gcc.test-framework/dg-excess-errors-exp-XF.c new file mode 100644 index 00000000000..496c6a60d50 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-excess-errors-exp-XF.c @@ -0,0 +1,9 @@ +/* Test the tester; previously gcc.misc-tests/dg-8.c. */ +/* { dg-prms-id 42 } */ +/* { dg-options "-Wall" } */ +/* { dg-do compile } */ +/* { dg-excess-errors "excess errors" } */ + +/* should get warning about defaulting return type - excess error */ + +main () { return 0; } diff --git a/gcc/testsuite/gcc.test-framework/dg-excess-errors-exp-XP.c b/gcc/testsuite/gcc.test-framework/dg-excess-errors-exp-XP.c new file mode 100644 index 00000000000..4aecca3ba34 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-excess-errors-exp-XP.c @@ -0,0 +1,9 @@ +/* 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; } diff --git a/gcc/testsuite/gcc.test-framework/dg-output-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-output-exp-P.c new file mode 100644 index 00000000000..4cec76f982c --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-output-exp-P.c @@ -0,0 +1,9 @@ +/* Test the tester; previously gcc.misc-tests/dg-5.c. */ +/* { dg-prms-id 42 } */ +/* { dg-do run } */ +/* The \n is left out of the pattern because tcl's exec will remove it. */ +/* { dg-output {Hello world[.]} } */ + +#include <stdio.h> + +main () { printf ("Hello world.\n"); return 0; } diff --git a/gcc/testsuite/gcc.test-framework/dg-output-exp-XF.c b/gcc/testsuite/gcc.test-framework/dg-output-exp-XF.c new file mode 100644 index 00000000000..6606e5c932a --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-output-exp-XF.c @@ -0,0 +1,9 @@ +/* Test the tester; previously gcc.misc-tests/dg-6.c. */ +/* { dg-prms-id 42 } */ +/* { dg-do run { target *-*-* } } */ +/* The \n is left out of the pattern because tcl's exec will remove it. */ +/* { dg-output {Hello world[.]} { xfail *-*-* } } */ + +#include <stdio.h> + +main () { printf ("Hello world (oops).\n"); return 0; } diff --git a/gcc/testsuite/gcc.test-framework/dg-warning-exp-P.c b/gcc/testsuite/gcc.test-framework/dg-warning-exp-P.c new file mode 100644 index 00000000000..293e1194df4 --- /dev/null +++ b/gcc/testsuite/gcc.test-framework/dg-warning-exp-P.c @@ -0,0 +1,11 @@ +/* Test the tester; previously part of gcc.misc-tests/dg-9.c. */ +/* { dg-prms-id 42 } */ +/* { dg-options "-Wall" } */ + +f () +{ /* { dg-warning "return type" "warning test" } */ +} /* { dg-warning "control reaches end" "warning test" } */ + +main (int argc, char *argv[]) +{ /* { dg-warning "return type" "warning test" } */ +} /* { dg-warning "control reaches end" "warning test" } */ diff --git a/gcc/testsuite/gcc.test-framework/test-framework.awk b/gcc/testsuite/gcc.test-framework/test-framework.awk index 90e76ca94b4..3c7eedb954a 100644 --- a/gcc/testsuite/gcc.test-framework/test-framework.awk +++ b/gcc/testsuite/gcc.test-framework/test-framework.awk @@ -47,6 +47,10 @@ BEGIN { skip = 1; passes = 0; fails = 0; } /^PASS.*dox.*(test for excess errors)/ { ignore(); next } # Ignore lines that begin with comma. /^,/ { 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 } } /^FAIL/ { if (match ($0, "exp-F")) { pass(); next } } /^XPASS/ { if (match ($0, "exp-XP")) { pass(); next } } diff --git a/gcc/testsuite/gcc.test-framework/test-framework.exp b/gcc/testsuite/gcc.test-framework/test-framework.exp index 21cdc1fb0b4..8bc4ae78502 100644 --- a/gcc/testsuite/gcc.test-framework/test-framework.exp +++ b/gcc/testsuite/gcc.test-framework/test-framework.exp @@ -46,8 +46,12 @@ global dg-do-what-default set save-dg-do-what-default ${dg-do-what-default} 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 generator "$srcdir/$subdir/gen_directive_tests" file delete -force $tstobjdir @@ -55,12 +59,11 @@ file mkdir $tstobjdir set status [remote_exec host "$generator $tstobjdir"] set status [lindex $status 0] if { $status == 0 } { - # Run the tests. - dg-init + # Run the generated tests. dg-runtest [lsort [find $tstobjdir *.c]] "" "-DY1 -DY2" - dg-finish } else { warning "Could not generate test framework tests" } +dg-finish set dg-do-what-default ${save-dg-do-what-default} |