gen_directive_tests
来自「用于进行gcc测试」· 代码 · 共 694 行 · 第 1/2 页
TXT
694 行
# 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}# Generate a test that uses a dg-do directive with a selector expression.dgdo_progs() { WHAT=$1 KIND=$2 PROG="$3" NAME="$4" XPR="$5" FILE1=${NAME}-1.c FILE2=${NAME}-2.c rm -f $FILE1 touch $FILE1 echo '/* { dg-do' $WHAT '{' $KIND "$XPR" '} } */' >> $FILE1 echo "${PROG}" >> $FILE1 echo "${GOOD_PROG}" > $FILE2}# Use various selector-expressions that evaluate to TRUE in dg-do directives.selector_good() { NUM=101 for xpr in \ "$GOOD0" \ "$GOOD1" \ "$GOOD2" \ "{ ! $BAD0 }" \ "{ ! $BAD1 }" \ "{ ! { $BAD2 } }" \ "{ ! \"${BAD2}\" }" \ "{ $GOOD1 || $GOOD0 }" \ "{ $BAD1 || $GOOD0 }" \ "{ $GOOD0 && $GOOD1 }" \ "{ $BAD1 || { \"${GOOD2}\" && $GOOD1 } }" \ "{ { $BAD0 || $GOOD0 } && $GOOD0 }" \ "{ $GOOD1 && { \"${GOOD2}\" || $BAD1 } }" \ "{ \"${GOOD2}\" && { $GOOD1 || $BAD1 } }" do dgdo_progs compile target "$GOOD_PROG" "dots${NUM}-exp-P" "$xpr" dgdo_progs compile target "$BADC_PROG" "dots${NUM}-exp-F" "$xpr" dgdo_progs run xfail "$GOOD_PROG" "doxf${NUM}-exp-XP" "$xpr" dgdo_progs run xfail "$BADR_PROG" "doxf${NUM}-exp-XF" "$xpr" let NUM=NUM+1 done}# Use various selector-expressions that evaluate to FALSE in dg-do directives.selector_bad() { NUM=101 for xpr in \ "$BAD0" \ "$BAD1" \ "$BAD2" \ "{ ! $GOOD0 }" \ "{ ! $GOOD1 }" \ "{ ! { $GOOD2 } }" \ "{ ! \"${GOOD2}\" }" \ "{ $BAD1 || $BAD0 }" \ "{ $BAD0 && $GOOD1 }" \ "{ $GOOD1 && $BAD0 }" \ "{ $BAD1 || { $GOOD1 && $BAD0 } }" \ "{ { $GOOD1 || $BAD1 } && $BAD0 }" \ "{ $BAD1 || { \"${BAD2}\" && $GOOD1 } }" \ "{ \"${BAD2}\" && { $GOOD1 || $BAD1 } }" do dgdo_progs compile target "$GOOD_PROG" "dotn${NUM}-exp-U" "$xpr" dgdo_progs run xfail "$GOOD_PROG" "doxp${NUM}-exp-P" "$xpr" dgdo_progs run xfail "$BADR_PROG" "doxp${NUM}-exp-F" "$xpr" let NUM=NUM+1 done}# Write a test whose directive is too long and messy to do as one string.deep_progs() { PROG="$1" NAME=$2 CMD1="$3" CMD2="$4" CMD3="$5" FILE1=${NAME}-1.c FILE2=${NAME}-2.c rm -f $FILE1 touch $FILE1 echo "$CMD1" "$CMD2" "$CMD3" > $FILE1 echo "$PROG" >> $FILE1 echo "$GOOD_PROG" > $FILE2}# Use nested expressions in various test directives.selector_deep() { GOODXPR="{ \"${GOOD2}\" && { ! { $BAD0 || $BAD1 } } }" BADXPR="{ ! { \"${GOOD2}\" || { $GOOD1 && $BAD1 } } }" NUM=100 dgdo_progs compile target "$GOOD_PROG" "dots${NUM}-exp-P" "$GOODXPR" dgdo_progs compile target "$GOOD_PROG" "dotn${NUM}-exp-U" "$BADXPR" deep_progs "$BADC_PROG" "xiff-100-exp-XF" \ '/* { dg-xfail-if "match" { ' "{ $GOODXPR }" ' } { "*" } { "" } } */' deep_progs "$GOOD_PROG" "xifp-100-exp-P" \ '/* { dg-xfail-if "no match" { ' "{ $BADXPR }" ' } { "*" } { "" } } */' deep_progs "$BADC_PROG" "xifn-100-exp-U" \ '/* { dg-skip-if "match" { ' "{ $GOODXPR }" ' } { "*" } { "" } } */' deep_progs "$GOOD_PROG" "xifs-100-exp-P" \ '/* { dg-skip-if "match" { ' "{ $BADXPR }" ' } { "*" } { "" } } */' deep_progs "$GOOD_PROG" "satn-100-exp-P" \ '/* { dg-final { scan-assembler-not "unexpected garbage" { target ' \ "$GOODXPR" ' } } } */' deep_progs "$GOOD_PROG" "satn-100-exp-U" \ '/* { dg-final { scan-assembler-not "unexpected garbage" { target ' \ "$BADXPR" ' } } } */' deep_progs "$GOOD_PROG" "satf-100-exp-XP" \ '/* { dg-final { scan-assembler-not "unexpected garbage" { xfail ' \ "$GOODXPR" ' } } } */' deep_progs "$GOOD_PROG" "satp-100-exp-P" \ '/* { dg-final { scan-assembler-not "unexpected garbage" { xfail ' \ "$BADXPR" ' } } } */'}selector_goodselector_badselector_deepone_all saxp $EXP_PASS noone_all saxf $EXP_XPASS noone_all sats $EXP_PASS noone_all satn $EXP_SKIP noone_all dots $EXP_PASS yesone_all dotn $EXP_SKIP noone_all doxp $EXP_PASS yesone_all doxf $EXP_XPASS yesone_all sifs $EXP_PASS yesone_all sifn $EXP_SKIP noone_all xifp $EXP_PASS yesone_all xiff $EXP_XPASS yesone_all reqs $EXP_PASS yesone_all reqn $EXP_SKIP notwo_all dots xifp $EXP_PASS yestwo_all dots xiff $EXP_XPASS yestwo_all dots sifs $EXP_PASS yestwo_all dots sifn $EXP_SKIP notwo_all dotn xifp $EXP_SKIP notwo_all dotn sifs $EXP_SKIP notwo_all dotn sifn $EXP_SKIP notwo_all dotn xiff $EXP_SKIP notwo_all dots reqs $EXP_PASS yestwo_all dots reqn $EXP_SKIP notwo_all dotn reqs $EXP_SKIP notwo_all dotn reqn $EXP_SKIP notwo_all doxp xifp $EXP_PASS yestwo_all doxp xiff $EXP_PASS yes # dg-xfail-if applies to compile, not runtwo_all doxp sifs $EXP_PASS yestwo_all doxp sifn $EXP_SKIP notwo_all doxf xifp $EXP_XPASS yestwo_all doxf xiff $EXP_XPASS yestwo_all doxf sifs $EXP_XPASS yestwo_all doxf sifn $EXP_SKIP notwo_all doxp reqs $EXP_PASS yestwo_all doxp reqn $EXP_SKIP notwo_all doxf reqs $EXP_XPASS yestwo_all doxf reqn $EXP_SKIP notwo_all reqs xifp $EXP_PASS yestwo_all reqs xiff $EXP_XPASS yestwo_all reqs sifs $EXP_PASS yestwo_all reqs sifn $EXP_SKIP notwo_all reqn xifp $EXP_SKIP notwo_all reqn xiff $EXP_SKIP notwo_all reqn sifs $EXP_SKIP notwo_all reqn sifn $EXP_SKIP notwo_all xifp reqs $EXP_PASS yestwo_all xiff reqs $EXP_XPASS yestwo_all sifs reqs $EXP_PASS yestwo_all sifn reqs $EXP_SKIP notwo_all xifp reqn $EXP_SKIP notwo_all xiff reqn $EXP_SKIP notwo_all sifs reqn $EXP_SKIP notwo_all sifn reqn $EXP_SKIP nothree_all dots reqs xifp $EXP_PASS yesthree_all dots reqs xiff $EXP_XPASS yesthree_all dots reqs sifs $EXP_PASS yesthree_all dots reqs sifn $EXP_SKIP nothree_all dots reqn xifp $EXP_SKIP nothree_all dots reqn xiff $EXP_SKIP nothree_all dots reqn sifs $EXP_SKIP nothree_all dots reqn sifn $EXP_SKIP nothree_all dotn reqs xifp $EXP_SKIP nothree_all dotn reqs xiff $EXP_SKIP nothree_all dotn reqs sifs $EXP_SKIP nothree_all dotn reqs sifn $EXP_SKIP nothree_all dotn reqn xifp $EXP_SKIP nothree_all dotn reqn xiff $EXP_SKIP nothree_all dotn reqn sifs $EXP_SKIP nothree_all dotn reqn sifn $EXP_SKIP no#three_all dots xifp reqs $EXP_PASS yesthree_all dots xiff reqs $EXP_XPASS yesthree_all dots sifs reqs $EXP_PASS yesthree_all dots sifn reqs $EXP_SKIP nothree_all dots xifp reqn $EXP_SKIP nothree_all dots xiff reqn $EXP_SKIP nothree_all dots sifs reqn $EXP_SKIP nothree_all dots sifn reqn $EXP_SKIP nothree_all dotn xifp reqs $EXP_SKIP nothree_all dotn xiff reqs $EXP_SKIP nothree_all dotn sifs reqs $EXP_SKIP nothree_all dotn sifn reqs $EXP_SKIP nothree_all dotn xifp reqn $EXP_SKIP nothree_all dotn xiff reqn $EXP_SKIP nothree_all dotn sifs reqn $EXP_SKIP nothree_all dotn sifn reqn $EXP_SKIP nothree_all doxp reqs xifp $EXP_PASS yesthree_all doxp reqs xiff $EXP_PASS yes # dg-xfail-if applies to compile, not runthree_all doxp reqs sifs $EXP_PASS yesthree_all doxp reqs sifn $EXP_SKIP nothree_all doxp reqn xifp $EXP_SKIP nothree_all doxp reqn xiff $EXP_SKIP nothree_all doxp reqn sifs $EXP_SKIP nothree_all doxp reqn sifn $EXP_SKIP nothree_all doxf reqs xifp $EXP_XPASS yesthree_all doxf reqs xiff $EXP_XPASS yesthree_all doxf reqs sifs $EXP_XPASS yesthree_all doxf reqs sifn $EXP_SKIP nothree_all doxf reqn xifp $EXP_SKIP nothree_all doxf reqn xiff $EXP_SKIP nothree_all doxf reqn sifs $EXP_SKIP nothree_all doxf reqn sifn $EXP_SKIP nothree_all doxp xifp reqs $EXP_PASS yesthree_all doxp xiff reqs $EXP_PASS yes # dg-xfail-if applies to compile, not runthree_all doxp sifs reqs $EXP_PASS yesthree_all doxp sifn reqs $EXP_SKIP nothree_all doxp xifp reqn $EXP_SKIP nothree_all doxp xiff reqn $EXP_SKIP nothree_all doxp sifs reqn $EXP_SKIP nothree_all doxp sifn reqn $EXP_SKIP nothree_all doxf xifp reqs $EXP_XPASS yesthree_all doxf xiff reqs $EXP_XPASS yesthree_all doxf sifs reqs $EXP_XPASS yesthree_all doxf sifn reqs $EXP_SKIP nothree_all doxf xifp reqn $EXP_SKIP nothree_all doxf xiff reqn $EXP_SKIP nothree_all doxf sifs reqn $EXP_SKIP nothree_all doxf sifn reqn $EXP_SKIP no
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?