This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] contrib: tools to test the dg test framework


On Tue, Nov 02, 2004 at 02:51:56PM -0800, Janis Johnson wrote:
> I've been using the following to test change to the test framework that
> I'm developing and figured they might be useful to other people as well.
> This patch would put them into a new directory under contrib/.  Any
> interest in putting them there?

This expanded version includes use of dg-target-list.  Once again I'm
submitting it primarily to show how I've tested the framework changes.

2004-11-05  Janis Johnson  <janis187@us.ibm.com>

	* test_framework/README: New file.
	* test_framework/test-framework.exp: New file.
	* test_framework/test-framework.awk: New file.
	* test_framework/generate_framework_tests: New file.

--- /dev/null	2004-06-24 11:06:20.000000000 -0700
+++ test_framework/README	2004-11-05 10:45:52.000000000 -0800
@@ -0,0 +1,28 @@
+Test dg- commands used in GCC's test framework by generating and running
+tests that use combinations of those commands.  Each test has two parts:
+a file ending in "-1.c" whose expected result is encoded in the filename
+and a file ending in "-2.c" which is always expected to pass.
+
+To run these tests using sources in $SRC:
+
+1. Set up the testsuite.
+
+     CTF=${SRC}/contrib/test_framework
+     mkdir ${SRC}/gcc/testsuite/gcc.test_framework
+     cd ${SRC}/gcc/testsuite/gcc.test_framework
+     cp ${CTF}/test-framework.exp .
+     ${CTF}/generate_framework_tests
+
+2. Export the environment variable CHECK_TEST_FRAMEWORK.  Define and
+   export whatever environment variables are needed for running the
+   testsuite, and run the tests:
+
+     cd <build_directory>
+     make -k check-gcc RUNTESTFLAGS="test-framework.exp"
+
+3. Check that the results are as expected:
+
+     awk -f ${CTF}/test-framework.awk gcc/testsuite/gcc.sum
+
+   The awk script prints unexpected results followed by the number of
+   tests that passed.
--- /dev/null	2004-06-24 11:06:20.000000000 -0700
+++ test_framework/test-framework.exp	2004-11-05 10:45:27.000000000 -0800
@@ -0,0 +1,58 @@
+# Copyright (c) 2002, 2003, 2004 Free Software Foundation, Inc.
+#
+# This file 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.
+#
+# For a copy of the GNU General Public License, write the the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Based on gcc/testsuite/gcc.dg/dg.exp.
+
+# Don't run these tests unless an environment variable is defined.
+if { ![info exists env(CHECK_TEST_FRAMEWORK)] } {
+    return
+}
+
+load_lib gcc-dg.exp
+
+proc dg-require-true { args } {
+    verbose "dg-require-true" 2
+}
+
+proc dg-require-false { args } {
+    verbose "dg-require-false" 2
+    #skip_test_and_clear_xfail
+    global compiler_conditional_xfail_data
+    upvar dg-do-what dg-do-what
+
+    set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+    if [info exists compiler_conditional_xfail_data] {
+        unset compiler_conditional_xfail_data
+    }
+}
+
+proc check_true { } {
+    return 1
+}
+
+proc check_false { } {
+    return 0
+}
+
+global dg-do-what-default
+set save-dg-do-what-default ${dg-do-what-default}
+set dg-do-what-default compile
+
+dg-init
+dg-runtest [lsort [find $srcdir/$subdir *.c]] "" ""
+dg-finish
+
+set dg-do-what-default ${save-dg-do-what-default}
--- /dev/null	2004-06-24 11:06:20.000000000 -0700
+++ test_framework/test-framework.awk	2004-11-05 10:45:34.000000000 -0800
@@ -0,0 +1,42 @@
+# Process the gcc.sum file for a run through gcc.test-framework.
+# Print result lines that show potential problems.  Report the number
+# of passing tests.
+#
+#
+# Copyright (c) 2004 Free Software Foundation, Inc.
+#
+# This file 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.
+#
+# For a copy of the GNU General Public License, write the the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+BEGIN			{ skip = 1; pass = 0 }
+/Running.*test-frame/	{ skip = 0; next }
+/gcc Summary/		{ skip = 1; next }
+			{ if (skip) next }
+/^$/			{ next }
+# The post tests are always expected to pass.
+/^PASS.*-2.c/		{ next }
+# dg-xfail-if applies to the compile step; these should be XPASS for the
+# compile step on dox tests, which are run tests.
+/^XPASS.*dox.*xiff.*-1.c.*(test for excess errors)/ { next }
+# xfail for scan-assembler-not tests doesn't apply to the compile step.
+/^PASS.*sa.*-1.c.*(test for excess errors)/ { next }
+# The other dox tests pass the compile step; ignore that message.
+/^PASS.*dox.*(test for excess errors)/ { 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 } }
+/^XFAIL/		{ if (match ($0, "exp-XF")) { pass++; next } }
+/^UNSUPPORTED/		{ if (match ($0, "exp-U")) { pass++; next } }
+			{ print }
+END			{ printf("%d tests passed\n", pass) }
--- /dev/null	2004-06-24 11:06:20.000000000 -0700
+++ test_framework/generate_framework_tests	2004-11-05 13:04:36.000000000 -0800
@@ -0,0 +1,509 @@
+#! /bin/sh
+
+########################################################################
+#
+# File:    generate_framework_tests
+# Author:  Janis Johnson
+# Date:    2004/11/02
+#
+# Generate tests of GCC's test framework.  Each test has encoded in
+# its name the dg commands that are used in the test and the expected
+# result of the test, *-1.c.  Each test is followed by a test ending
+# in *-2.c that is expected to pass.
+#
+# This script has evolved and could be rewritten to be more compact.
+#
+#
+# Copyright (c) 2004 Free Software Foundation, Inc.
+#
+# This file 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.
+#
+# For a copy of the GNU General Public License, write the the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+########################################################################
+
+GOOD0='*-*-*'
+GOOD1='[istarget *-*-*]'
+GOOD2='[check_true]'
+GOOD3='[expr [istarget *-*-*] && [check_true]]'
+GOOD4='[expr [istarget empty-empty-empty] || [expr [check_true] && [istarget *-*-*]]]'
+BAD0='empty-empty-empty'
+BAD1='[istarget empty-empty-empty]'
+BAD2='[check_false]'
+BAD3='[expr [istarget empty-empty-empty] && [check_true]]'
+BAD4='[expr [istarget empty-empty-empty] || [expr [check_false] && [istarget *-*-*]]]'
+
+# Programs used in the tests: good compile and run, bad compile, and
+# bad run.
+GOOD_PROG="int main () { return 0; }"
+BADC_PROG="int missing_body () }"
+BADR_PROG="extern void abort (void); int main () { abort (); }"
+
+# dg-do commands with a target list.
+DOT_S0="{ dg-do compile { target ${GOOD0} } }"
+DOT_S1="{ dg-do compile [dg-target-list target ${GOOD1}] }"
+DOT_S2="{ dg-do compile [dg-target-list target ${GOOD2}] }"
+DOT_S3="{ dg-do compile [dg-target-list target ${GOOD3}] }"
+DOT_S4="{ dg-do compile [dg-target-list target ${GOOD4}] }"
+DOT_N0="{ dg-do compile { target ${BAD0} } }"
+DOT_N1="{ dg-do compile [dg-target-list target ${BAD1}] }"
+DOT_N2="{ dg-do compile [dg-target-list target ${BAD2}] }"
+DOT_N3="{ dg-do compile [dg-target-list target ${BAD3}] }"
+DOT_N4="{ dg-do compile [dg-target-list target ${BAD4}] }"
+
+# dg-do commands with an xfail list; the xfail list is ignored for
+# everything but "run".
+DOX_P0="{ dg-do run { xfail ${BAD0} } }"
+DOX_P1="{ dg-do run [dg-target-list xfail ${BAD1}] }"
+DOX_P2="{ dg-do run [dg-target-list xfail ${BAD2}] }"
+DOX_P3="{ dg-do run [dg-target-list xfail ${BAD3}] }"
+DOX_P4="{ dg-do run [dg-target-list xfail ${BAD4}] }"
+DOX_F0="{ dg-do run { xfail ${GOOD0} } }"
+DOX_F1="{ dg-do run [dg-target-list xfail ${GOOD1}] }"
+DOX_F2="{ dg-do run [dg-target-list xfail ${GOOD2}] }"
+DOX_F3="{ dg-do run [dg-target-list xfail ${GOOD3}] }"
+DOX_F4="{ dg-do run [dg-target-list xfail ${GOOD4}] }"
+
+# dg-xfail-if commands.
+XIF_P0="{ dg-xfail-if \"target not matched\" { ${BAD0} } { \"*\" } { \"\" } }"
+XIF_P1="{ dg-xfail-if \"target not matched\" [dg-target-list \"\" ${BAD1}] { \"*\" } { \"\" } }"
+XIF_P2="{ dg-xfail-if \"target not matched\" [dg-target-list \"\" ${BAD2}] { \"*\" } { \"\" } }"
+XIF_P3="{ dg-xfail-if \"target not matched\" [dg-target-list \"\" ${BAD3}] { \"*\" } { \"\" } }"
+XIF_P4="{ dg-xfail-if \"target not matched\" [dg-target-list \"\" ${BAD4}] { \"*\" } { \"\" } }"
+XIF_Q0="{ dg-xfail-if \"options not matched\" { ${GOOD0} } { \"-bad-option\" } { \"\" } }"
+XIF_Q1="{ dg-xfail-if \"options not matched\" [dg-target-list \"\" ${GOOD1}] { \"-bad-option\" } { \"\" } }"
+XIF_Q2="{ dg-xfail-if \"options not matched\" [dg-target-list \"\" ${GOOD2}] { \"-bad-option\" } { \"\" } }"
+XIF_Q3="{ dg-xfail-if \"options not matched\" [dg-target-list \"\" ${GOOD3}] { \"-bad-option\" } { \"\" } }"
+XIF_Q4="{ dg-xfail-if \"options not matched\" [dg-target-list \"\" ${GOOD4}] { \"-bad-option\" } { \"\" } }"
+XIF_F0="{ dg-xfail-if \"target matched\" { ${GOOD0} } { \"*\" } { \"\" } }"
+XIF_F1="{ dg-xfail-if \"target matched\" [dg-target-list \"\" ${GOOD1}] { \"*\" } { \"\" } }"
+XIF_F2="{ dg-xfail-if \"target matched\" [dg-target-list \"\" ${GOOD2}] { \"*\" } { \"\" } }"
+XIF_F3="{ dg-xfail-if \"target matched\" [dg-target-list \"\" ${GOOD3}] { \"*\" } { \"\" } }"
+XIF_F4="{ dg-xfail-if \"target matched\" [dg-target-list \"\" ${GOOD4}] { \"*\" } { \"\" } }"
+
+# dg-require-* commands, using procedures defined for this set of tests.
+REQ_S0="{ dg-require-true \"\" }"    # do not skip the test
+REQ_N0="{ dg-require-false \"\" }"   # skip the test
+
+# scan-assembler-not, which is hoped to be representative of commands
+# used with dg-final, with a target list.
+SAT_N0="{ dg-final { scan-assembler-not \"unexpected gargage\" { target ${BAD0} } } }"
+SAT_N1="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list target ${BAD1}] } }"
+SAT_N2="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list target ${BAD2}] } }"
+SAT_N3="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list target ${BAD3}] } }"
+SAT_N4="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list target ${BAD4}] } }"
+SAT_S0="{ dg-final { scan-assembler-not \"unexpected gargage\" { target ${GOOD0} } } }"
+SAT_S1="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list target ${GOOD1}] } }"
+SAT_S2="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list target ${GOOD2}] } }"
+SAT_S3="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list target ${GOOD3}] } }"
+SAT_S4="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list target ${GOOD4}] } }"
+
+# scan-assembler-not, which is hoped to be representative of commands
+# used with dg-final, with an xfail list.
+SAX_P0="{ dg-final { scan-assembler-not \"unexpected gargage\" { xfail ${BAD0} } } }"
+SAX_P1="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list xfail ${BAD1}] } }"
+SAX_P2="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list xfail ${BAD2}] } }"
+SAX_P3="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list xfail ${BAD3}] } }"
+SAX_P4="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list xfail ${BAD4}] } }"
+SAX_F0="{ dg-final { scan-assembler-not \"unexpected gargage\" { xfail ${GOOD0} } } }"
+SAX_F1="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list xfail ${GOOD1}] } }"
+SAX_F2="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list xfail ${GOOD2}] } }"
+SAX_F3="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list xfail ${GOOD3}] } }"
+SAX_F4="{ dg-final { scan-assembler-not \"unexpected gargage\" [dg-target-list xfail ${GOOD4}] } }"
+
+KIND_LIST=""
+
+# Expected result of the *-1.c test, encoded into the file name.
+EXP_PASS="exp-P"
+EXP_XPASS="exp-XP"
+EXP_SKIP="exp-U"
+EXP_FAIL="exp-F"
+EXP_XFAIL="exp-XF"
+
+get_list() {
+    KIND=$1
+    case $KIND in
+      "dots") KIND_LIST="dots0 dots1 dots2 dots3 dots4";;
+      "dotn") KIND_LIST="dotn0 dotn1 dotn2 dotn3 dotn4";;
+      "doxp") KIND_LIST="doxp0 doxp1 doxp2 doxp3 doxp4";;
+      "doxf") KIND_LIST="doxf0 doxf1 doxf2 doxf3 doxf4";;
+      "xifp") KIND_LIST="xifp0 xifp1 xifp2 xifp3 xifp4";;
+      "xifq") KIND_LIST="xifq0 xifq1 xifq2 xifq3 xifq4";;
+      "xiff") KIND_LIST="xiff0 xiff1 xiff2 xiff3 xiff4";;
+      "sats") KIND_LIST="sats0 sats1 sats2 sats3 sats4";;
+      "satn") KIND_LIST="satn0 satn1 satn2 satn3 satn4";;
+      "saxp") KIND_LIST="saxp0 saxp1 saxp2 saxp3 saxp4";;
+      "saxf") KIND_LIST="saxf0 saxf1 saxf2 saxf3 saxf4";;
+      "reqs") KIND_LIST="reqs0";;
+      "reqn") KIND_LIST="reqn0";;
+      *) echo "oops: $KIND"; exit 1;;
+    esac
+}
+
+cmd() {
+    KIND=$1
+    FILE=$2
+
+    case $KIND in
+      "dots") echo '/*' "${DOT_S0}" '*/' >> $FILE;;
+      "dots0") echo '/*' "${DOT_S0}" '*/' >> $FILE;;
+      "dots1") echo '/*' "${DOT_S1}" '*/' >> $FILE;;
+      "dots2") echo '/*' "${DOT_S2}" '*/' >> $FILE;;
+      "dots3") echo '/*' "${DOT_S3}" '*/' >> $FILE;;
+      "dots4") echo '/*' "${DOT_S4}" '*/' >> $FILE;;
+      "dotn") echo '/*' "${DOT_N0}" '*/' >> $FILE;;
+      "dotn0") echo '/*' "${DOT_N0}" '*/' >> $FILE;;
+      "dotn1") echo '/*' "${DOT_N1}" '*/' >> $FILE;;
+      "dotn2") echo '/*' "${DOT_N2}" '*/' >> $FILE;;
+      "dotn3") echo '/*' "${DOT_N3}" '*/' >> $FILE;;
+      "dotn4") echo '/*' "${DOT_N4}" '*/' >> $FILE;;
+      "doxp") echo '/*' "${DOX_P0}" '*/' >> $FILE;;
+      "doxp0") echo '/*' "${DOX_P0}" '*/' >> $FILE;;
+      "doxp1") echo '/*' "${DOX_P1}" '*/' >> $FILE;;
+      "doxp2") echo '/*' "${DOX_P2}" '*/' >> $FILE;;
+      "doxp3") echo '/*' "${DOX_P3}" '*/' >> $FILE;;
+      "doxp4") echo '/*' "${DOX_P4}" '*/' >> $FILE;;
+      "doxf") echo '/*' "${DOX_F0}" '*/' >> $FILE;;
+      "doxf0") echo '/*' "${DOX_F0}" '*/' >> $FILE;;
+      "doxf1") echo '/*' "${DOX_F1}" '*/' >> $FILE;;
+      "doxf2") echo '/*' "${DOX_F2}" '*/' >> $FILE;;
+      "doxf3") echo '/*' "${DOX_F3}" '*/' >> $FILE;;
+      "doxf4") echo '/*' "${DOX_F4}" '*/' >> $FILE;;
+      "xifp") echo '/*' "${XIF_P0}" '*/' >> $FILE;;
+      "xifp0") echo '/*' "${XIF_P0}" '*/' >> $FILE;;
+      "xifp1") echo '/*' "${XIF_P1}" '*/' >> $FILE;;
+      "xifp2") echo '/*' "${XIF_P2}" '*/' >> $FILE;;
+      "xifp3") echo '/*' "${XIF_P3}" '*/' >> $FILE;;
+      "xifp4") echo '/*' "${XIF_P4}" '*/' >> $FILE;;
+      "xifq") echo '/*' "${XIF_Q0}" '*/' >> $FILE;;
+      "xifq0") echo '/*' "${XIF_Q0}" '*/' >> $FILE;;
+      "xifq1") echo '/*' "${XIF_Q1}" '*/' >> $FILE;;
+      "xifq2") echo '/*' "${XIF_Q2}" '*/' >> $FILE;;
+      "xifq3") echo '/*' "${XIF_Q3}" '*/' >> $FILE;;
+      "xifq4") echo '/*' "${XIF_Q4}" '*/' >> $FILE;;
+      "xiff") echo '/*' "${XIF_F0}" '*/' >> $FILE;;
+      "xiff0") echo '/*' "${XIF_F0}" '*/' >> $FILE;;
+      "xiff1") echo '/*' "${XIF_F1}" '*/' >> $FILE;;
+      "xiff2") echo '/*' "${XIF_F2}" '*/' >> $FILE;;
+      "xiff3") echo '/*' "${XIF_F3}" '*/' >> $FILE;;
+      "xiff4") echo '/*' "${XIF_F4}" '*/' >> $FILE;;
+      "satn") echo '/*' "${SAT_N0}" '*/' >> $FILE;;
+      "satn0") echo '/*' "${SAT_N0}" '*/' >> $FILE;;
+      "satn1") echo '/*' "${SAT_N1}" '*/' >> $FILE;;
+      "satn2") echo '/*' "${SAT_N2}" '*/' >> $FILE;;
+      "satn3") echo '/*' "${SAT_N3}" '*/' >> $FILE;;
+      "satn4") echo '/*' "${SAT_N4}" '*/' >> $FILE;;
+      "sats") echo '/*' "${SAT_S0}" '*/' >> $FILE;;
+      "sats0") echo '/*' "${SAT_S0}" '*/' >> $FILE;;
+      "sats1") echo '/*' "${SAT_S1}" '*/' >> $FILE;;
+      "sats2") echo '/*' "${SAT_S2}" '*/' >> $FILE;;
+      "sats3") echo '/*' "${SAT_S3}" '*/' >> $FILE;;
+      "sats4") echo '/*' "${SAT_S4}" '*/' >> $FILE;;
+      "saxp") echo '/*' "${SAX_P0}" '*/' >> $FILE;;
+      "saxp0") echo '/*' "${SAX_P0}" '*/' >> $FILE;;
+      "saxp1") echo '/*' "${SAX_P1}" '*/' >> $FILE;;
+      "saxp2") echo '/*' "${SAX_P2}" '*/' >> $FILE;;
+      "saxp3") echo '/*' "${SAX_P3}" '*/' >> $FILE;;
+      "saxp4") echo '/*' "${SAX_P4}" '*/' >> $FILE;;
+      "saxf") echo '/*' "${SAX_F0}" '*/' >> $FILE;;
+      "saxf0") echo '/*' "${SAX_F0}" '*/' >> $FILE;;
+      "saxf1") echo '/*' "${SAX_F1}" '*/' >> $FILE;;
+      "saxf2") echo '/*' "${SAX_F2}" '*/' >> $FILE;;
+      "saxf3") echo '/*' "${SAX_F3}" '*/' >> $FILE;;
+      "saxf4") echo '/*' "${SAX_F4}" '*/' >> $FILE;;
+      "reqs") echo '/*' "${REQ_S0}" '*/' >> $FILE;;
+      "reqs0") echo '/*' "${REQ_S0}" '*/' >> $FILE;;
+      "reqn") echo '/*' "${REQ_N0}" '*/' >> $FILE;;
+      "reqn0") echo '/*' "${REQ_N0}" '*/' >> $FILE;;
+      *) echo "oops: $KIND"; exit 1;;
+    esac
+}
+
+# Generate a test using a single dg- command.  If requested, generate a
+# second version that will fail.
+one() {
+    KIND=$1
+    EXP=$2
+    FAIL_VERSION=$3
+
+    NAME=${KIND}-${EXP}
+    FILE1=${NAME}-1.c
+    FILE2=${NAME}-2.c
+    rm -f $FILE1
+    touch $FILE1
+    cmd $KIND $FILE1
+    echo "${GOOD_PROG}" >> $FILE1
+    echo "${GOOD_PROG}" > $FILE2
+
+    if [ "${FAIL_VERSION}" == "yes" ]; then
+	if [ "${EXP}" == "${EXP_PASS}" ]; then
+	    NAME=${KIND}-${EXP_FAIL}
+	else
+	    NAME=${KIND}-${EXP_XFAIL}
+	fi
+
+	FILE1=${NAME}-1.c
+	FILE2=${NAME}-2.c
+	rm -f $FILE1
+	touch $FILE1
+	cmd $KIND $FILE1
+	case $KIND in
+	dox*)	echo "${BADR_PROG}" >> $FILE1;;
+	*)	echo "${BADC_PROG}" >> $FILE1;;
+	esac
+	echo "${GOOD_PROG}" > $FILE2
+    fi
+}
+
+# Generate a test using two dg- commands.  If requested, generate a
+# second version that will fail.
+two() {
+    KIND1=$1
+    KIND2=$2
+    EXP=$3
+    FAIL_VERSION=$4
+
+    NAME=${KIND1}-${KIND2}-${EXP}
+    FILE1=${NAME}-1.c
+    FILE2=${NAME}-2.c
+
+    rm -f $FILE1
+    touch $FILE1
+    cmd $KIND1 $FILE1
+    cmd $KIND2 $FILE1
+    echo "${GOOD_PROG}" >> $FILE1
+    echo "${GOOD_PROG}" > $FILE2
+
+    if [ "${FAIL_VERSION}" == "yes" ]; then
+	if [ "${EXP}" == "${EXP_PASS}" ]; then
+	    NAME=${KIND1}-${KIND2}-${EXP_FAIL}
+	else
+	    NAME=${KIND1}-${KIND2}-${EXP_XFAIL}
+	fi
+
+	FILE1=${NAME}-1.c
+	FILE2=${NAME}-2.c
+	rm -f $FILE1
+	touch $FILE1
+	cmd $KIND1 $FILE1
+	cmd $KIND2 $FILE1
+	# dg-do with an xfail list is only used as the first command.
+	case $KIND1 in
+	dox*)	echo "${BADR_PROG}" >> $FILE1;;
+	*)	echo "${BADC_PROG}" >> $FILE1;;
+	esac
+	echo "${GOOD_PROG}" > $FILE2
+    fi
+}
+
+# Generate a test using three dg- commands.  If requested generate a
+# second version that will fail.
+three() {
+    KIND1=$1
+    KIND2=$2
+    KIND3=$3
+    EXP=$4
+    FAIL_VERSION=$5
+
+    NAME=${KIND1}-${KIND2}-${KIND3}-${EXP}
+    FILE1=${NAME}-1.c
+    FILE2=${NAME}-2.c
+    rm -f $FILE1
+    touch $FILE1
+    cmd $KIND1 $FILE1
+    cmd $KIND2 $FILE1
+    cmd $KIND3 $FILE1
+    echo "${GOOD_PROG}" >> $FILE1
+    echo "${GOOD_PROG}" > $FILE2
+
+    if [ "${FAIL_VERSION}" == "${yes}" ]; then
+	if [ "${EXP}" == "${EXP_PASS}" ]; then
+	    NAME=${KIND1}-${KIND2}-${KIND3}-${EXP_FAIL}
+	else
+	    NAME=${KIND1}-${KIND2}-${KIND3}-${EXP_XFAIL}
+	fi
+
+	FILE1=${NAME}-1.c
+	FILE2=${NAME}-2.c
+	rm -f $FILE1
+	touch $FILE1
+	cmd $KIND1 $FILE1
+	cmd $KIND2 $FILE1
+	cmd $KIND3 $FILE1
+	# dg-do with an xfail list is only used as the first command.
+	case $KIND1 in
+	dox*)	echo "${BADR_PROG}" >> $FILE1;;
+	*)	echo "${BADC_PROG}" >> $FILE1;;
+	esac
+	echo "${GOOD_PROG}" > $FILE2
+    fi
+}
+
+# Generate tests using one dg- command.  Generate a test for each variant
+# of KIND.
+one_all() {
+    KIND=$1
+    EXP=$2
+    FAIL_VERSION=$3
+
+    get_list $KIND
+    for k in $KIND_LIST; do
+	one $k $EXP $FAIL_VERSION
+    done
+}
+
+# Generate tests using two dg- commands.  For each KIND, generate
+# a test for each of its variants.
+two_all() {
+    KIND1=$1
+    KIND2=$2
+    EXP=$3
+    FAIL_VERSION=$4
+
+    get_list $KIND1
+    KIND_LIST1="$KIND_LIST"
+    get_list $KIND2
+    KIND_LIST2="$KIND_LIST"
+    for k1 in $KIND_LIST1; do
+	for k2 in $KIND_LIST2; do
+	    two $k1 $k2 $EXP $FAIL_VERSION
+	done
+    done
+}
+
+# Generate tests using three dg- commands.  For each KIND, generate
+# a test for each of its variants.
+three_all() {
+    KIND1=$1
+    KIND2=$2
+    KIND3=$3
+    EXP=$4
+    FAIL_VERSION=$5
+
+    get_list $KIND1
+    KIND_LIST1="$KIND_LIST"
+    get_list $KIND2
+    KIND_LIST2="$KIND_LIST"
+    get_list $KIND3
+    KIND_LIST3="$KIND_LIST"
+    for k1 in $KIND_LIST1; do
+	for k2 in $KIND_LIST2; do
+	    for k3 in $KIND_LIST3; do
+		three $k1 $k2 $k3 $EXP $FAIL_VERSION
+	    done
+	done
+    done
+}
+
+one_all saxp $EXP_PASS no
+one_all saxf $EXP_XPASS no
+one_all sats $EXP_PASS no
+one_all satn $EXP_SKIP no
+one_all dots $EXP_PASS yes
+one_all dotn $EXP_SKIP no
+one_all doxp $EXP_PASS yes
+one_all doxf $EXP_XPASS yes
+one_all xifp $EXP_PASS yes
+one_all xifq $EXP_PASS yes
+one_all xiff $EXP_XPASS yes
+one_all reqs $EXP_PASS yes
+one_all reqn $EXP_SKIP no
+
+two_all dots xifp $EXP_PASS yes
+two_all dots xifq $EXP_PASS yes
+two_all dots xiff $EXP_XPASS yes
+two_all dotn xifp $EXP_SKIP no
+two_all dotn xifq $EXP_SKIP no
+two_all dotn xiff $EXP_SKIP no
+two_all dots reqs $EXP_PASS yes
+two_all dots reqn $EXP_SKIP no
+two_all dotn reqs $EXP_SKIP no
+two_all dotn reqn $EXP_SKIP no
+
+two_all doxp xifp $EXP_PASS yes
+two_all doxp xifq $EXP_PASS yes
+two_all doxp xiff $EXP_PASS yes   # dg-xfail-if applies to compile, not run
+two_all doxf xifp $EXP_XPASS yes
+two_all doxf xifq $EXP_XPASS yes
+two_all doxf xiff $EXP_XPASS yes
+
+two_all doxp reqs $EXP_PASS yes
+two_all doxp reqn $EXP_SKIP no
+two_all doxf reqs $EXP_XPASS yes
+two_all doxf reqn $EXP_SKIP no
+
+two_all reqs xifp $EXP_PASS yes
+two_all reqs xifq $EXP_PASS yes
+two_all reqs xiff $EXP_XPASS yes
+two_all reqn xifp $EXP_SKIP no
+two_all reqn xifq $EXP_SKIP no
+two_all reqn xiff $EXP_SKIP no
+
+two_all xifp reqs $EXP_PASS yes
+two_all xifq reqs $EXP_PASS yes
+two_all xiff reqs $EXP_XPASS yes
+two_all xifp reqn $EXP_SKIP no
+two_all xifq reqn $EXP_SKIP no
+two_all xiff reqn $EXP_SKIP no
+
+three_all dots reqs xifp $EXP_PASS yes
+three_all dots reqs xifq $EXP_PASS yes
+three_all dots reqs xiff $EXP_XPASS yes
+three_all dots reqn xifp $EXP_SKIP no
+three_all dots reqn xifq $EXP_SKIP no
+three_all dots reqn xiff $EXP_SKIP no
+three_all dotn reqs xifp $EXP_SKIP no
+three_all dotn reqs xifq $EXP_SKIP no
+three_all dotn reqs xiff $EXP_SKIP no
+three_all dotn reqn xifp $EXP_SKIP no
+three_all dotn reqn xifq $EXP_SKIP no
+three_all dotn reqn xiff $EXP_SKIP no
+#
+three_all dots xifp reqs $EXP_PASS yes
+three_all dots xifq reqs $EXP_PASS yes
+three_all dots xiff reqs $EXP_XPASS yes
+three_all dots xifp reqn $EXP_SKIP no
+three_all dots xifq reqn $EXP_SKIP no
+three_all dots xiff reqn $EXP_SKIP no
+three_all dotn xifp reqs $EXP_SKIP no
+three_all dotn xifq reqs $EXP_SKIP no
+three_all dotn xiff reqs $EXP_SKIP no
+three_all dotn xifp reqn $EXP_SKIP no
+three_all dotn xifq reqn $EXP_SKIP no
+three_all dotn xiff reqn $EXP_SKIP no
+
+three_all doxp reqs xifp $EXP_PASS yes
+three_all doxp reqs xifq $EXP_PASS yes
+three_all doxp reqs xiff $EXP_PASS yes # dg-xfail-if applies to compile, not run
+three_all doxp reqn xifp $EXP_SKIP no
+three_all doxp reqn xifq $EXP_SKIP no
+three_all doxp reqn xiff $EXP_SKIP no
+three_all doxf reqs xifp $EXP_XPASS yes
+three_all doxf reqs xifq $EXP_XPASS yes
+three_all doxf reqs xiff $EXP_XPASS yes
+three_all doxf reqn xifp $EXP_SKIP no
+three_all doxf reqn xifq $EXP_SKIP no
+three_all doxf reqn xiff $EXP_SKIP no
+
+three_all doxp xifp reqs $EXP_PASS yes
+three_all doxp xifq reqs $EXP_PASS yes
+three_all doxp xiff reqs $EXP_PASS yes # dg-xfail-if applies to compile, not run
+three_all doxp xifp reqn $EXP_SKIP no
+three_all doxp xifq reqn $EXP_SKIP no
+three_all doxp xiff reqn $EXP_SKIP no
+three_all doxf xifp reqs $EXP_XPASS yes
+three_all doxf xifq reqs $EXP_XPASS yes
+three_all doxf xiff reqs $EXP_XPASS yes
+three_all doxf xifp reqn $EXP_SKIP no
+three_all doxf xifq reqn $EXP_SKIP no
+three_all doxf xiff reqn $EXP_SKIP no


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]